in python/bot.py [0:0]
def lambda_handler(event, context):
assert context
log.debug(event)
bot_event = event
trigger_word = bot_event['trigger_word']
raw_text = bot_event['text']
raw_args = raw_text.replace(trigger_word, '').strip()
args = raw_args.split()
log.debug("[lambda_handler] args:{0}".format(args))
if len(args) >= 1:
command = args[0]
if command not in commands:
command = 'help'
service = None
if len(args) >= 2:
service = args[1]
options = ''
if len(args) >= 3:
options = args[2:]
log.debug("[lambda_handler] command:'{0}' service:'{1}' options:'{2}'".format(
command, service, options))
resp = commands[command](service, _options_to_dict(options))
return {
'text': "{0}".format(resp)
}