X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=turbot%2Finteraction.py;h=f9fcedee34b174dcc4bc2bd0669e3214c9ea72c9;hb=4b3efe6fde2dd926f5b54eb357ed732e9e04d9e0;hp=b81541c645db5fc549458fadb7ff8678c8fad09e;hpb=10dd20653d14706cc1c7689745f8bcd80c29fa2b;p=turbot diff --git a/turbot/interaction.py b/turbot/interaction.py index b81541c..f9fcede 100644 --- a/turbot/interaction.py +++ b/turbot/interaction.py @@ -16,10 +16,16 @@ from turbot.slack import slack_send_message import shlex actions = {} +actions['button'] = {} commands = {} submission_handlers = {} # Hunt/Puzzle IDs are restricted to lowercase letters, numbers, and underscores +# +# Note: This restriction not only allows for hunt and puzzle ID values to +# be used as Slack channel names, but it also allows for '-' as a valid +# separator between a hunt and a puzzle ID (for example in the puzzle +# edit dialog where a single attribute must capture both values). valid_id_re = r'^[_a-z0-9]+$' lambda_ok = {'statusCode': 200} @@ -63,6 +69,15 @@ def multi_static_select(turb, payload): actions['multi_static_select'] = {"*": multi_static_select} +def edit_puzzle(turb, payload): + """Handler for the action of user pressing an edit_puzzle button""" + + print("DEBUG: In edit_puzzle with payload: {}".format(str(payload))) + + return lambda_ok + +actions['button']['edit_puzzle'] = edit_puzzle + def new_hunt(turb, payload): """Handler for the action of user pressing the new_hunt button""" @@ -88,7 +103,7 @@ def new_hunt(turb, payload): return lambda_ok -actions['button'] = {"new_hunt": new_hunt} +actions['button']['new_hunt'] = new_hunt def new_hunt_submission(turb, payload, metadata): """Handler for the user submitting the new hunt modal