Created
August 13, 2018 22:28
-
-
Save kojiisd/172e3919db44be42633e7863943b8486 to your computer and use it in GitHub Desktop.
今さらだけどAlexaのカスタムスキルを作ってみた ref: https://qiita.com/kojiisd/items/bc6e53026b08fca38aab
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import datetime | |
import locale | |
def lambda_handler(event, context): | |
intent = event['request']['intent'] | |
date_str = intent['slots']['date']['value'] | |
locale.setlocale(locale.LC_TIME, 'ja_JP.UTF-8') | |
date = datetime.datetime.strptime(date_str, '%Y-%m-%d') | |
res_str = date.strftime("%Y") + "年" + date.strftime("%m") + "月" + date.strftime("%d") + "日は、" + date.strftime("%A") + "です。" | |
response = { | |
'version': '1.0', | |
'response': { | |
'outputSpeech': { | |
'type': 'PlainText', | |
'text': res_str | |
} | |
} | |
} | |
return response |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment