]> git.cworth.org Git - turbot/blobdiff - turbot_lambda/turbot_lambda.py
Combine actions.py and commands.py into interaction.py
[turbot] / turbot_lambda / turbot_lambda.py
index 59312c8b2e1e19e7b573b7e108cc2458384cb286..8365739fa24e5e7881d282a79ddd4b0d47663ee1 100644 (file)
@@ -10,8 +10,7 @@ from types import SimpleNamespace
 from google.auth.transport.requests import Request
 from googleapiclient.discovery import build
 
-import turbot.actions
-import turbot.commands
+import turbot.interaction
 import turbot.events
 
 ssm = boto3.client('ssm')
@@ -166,7 +165,7 @@ def turbot_interactive(turb, payload):
     if type == 'block_actions':
         return turbot_block_action(turb, payload)
     if type == 'view_submission':
-        return turbot.actions.view_submission(turb, payload)
+        return turbot.interaction.view_submission(turb, payload)
     if type == 'shortcut':
         return turbot_shortcut(turb, payload);
     return error("Unrecognized interactive type: {}".format(type))
@@ -188,10 +187,10 @@ def turbot_block_action(turb, payload):
     avalue = action['value']
 
     if (
-            atype in turbot.actions.actions
-            and avalue in turbot.actions.actions[atype]
+            atype in turbot.interaction.actions
+            and avalue in turbot.interaction.actions[atype]
     ):
-        return turbot.actions.actions[atype][avalue](turb, payload)
+        return turbot.interaction.actions[atype][avalue](turb, payload)
     return error("Unknown action of type/value: {}/{}".format(atype, avalue))
 
 def turbot_shortcut(turb, payload):
@@ -216,7 +215,7 @@ def turbot_slash_command(turb, body):
     else:
         args = ''
 
-    if command in turbot.commands.commands:
-        return turbot.commands.commands[command](turb, body, args)
+    if command in turbot.interaction.commands:
+        return turbot.interation.commands[command](turb, body, args)
 
     return error("Command {} not implemented".format(command))