]> git.cworth.org Git - turbot/commitdiff
Add a stub function for hanlding a shortcut invocation
authorCarl Worth <cworth@cworth.org>
Wed, 21 Oct 2020 16:39:54 +0000 (09:39 -0700)
committerCarl Worth <cworth@cworth.org>
Wed, 21 Oct 2020 17:50:54 +0000 (10:50 -0700)
We're not currently pursuing this option, (because the global shortcuts
are annoyingly truly global---they would be a lot more useful it the
payload included the ID of the current channel from where they were
invoked). But here's the stub in case we ever want to start using these
in the future.

turbot_lambda/turbot_lambda.py

index 46db3ce1fb6ebfe987e1500d7386de5de90e93ef..2ba91842de0cd622a382625695ec5c8be4e6a528 100644 (file)
@@ -167,6 +167,8 @@ def turbot_interactive(turb, payload):
         return turbot_block_action(turb, payload)
     if type == 'view_submission':
         return turbot.actions.view_submission(turb, payload)
+    if type == 'shortcut':
+        return turbot_shortcut(turb, payload);
     return error("Unrecognized interactive type: {}".format(type))
 
 def turbot_block_action(turb, payload):
@@ -192,6 +194,15 @@ def turbot_block_action(turb, payload):
         return turbot.actions.actions[atype][avalue](turb, payload)
     return error("Unknown action of type/value: {}/{}".format(atype, avalue))
 
+def turbot_shortcut(turb, payload):
+    """Handler for Slack shortcuts
+
+    These are invoked as either global or message shortcuts by a user."""
+
+    print("In turbot_shortcut, payload is: {}".format(str(payload)))
+
+    return error("Shortcut interactions not yet implemented")
+
 def turbot_slash_command(turb, body):
     """Implementation for Slack slash commands.