This allows the turbot/commands.py file to be self-sufficient, in the
sense that adding a new command will not require changing any of the
dispatch code above in turbot_lambda.py, but instead just the local
dispatch table.
'statusCode': 200,
'body': ""
}
+
+commands = {
+ "/rot": rot
+}
command = body['command'][0]
args = body['text'][0]
- if (command == "/rotlambda" or command == "/rot"):
- return turbot.commands.rot(slack_client, body, args)
+ if command in turbot.commands.commands:
+ return turbot.commands.commands[command](slack_client, body, args)
return error("Command {} not implemented".format(command))