summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
d124e7c)
Some buttons appear in a context, (like the app's "Home" view), where
there is no response_url, (we can't generate a message there). So we
can't rely on this. And we don't need to anyway, we can use the string
in the reteurn value to get an error message out to the user.
This commit should fix a bunch of broken puzzle edits button in the
Turbot "home" view.
"""Handler for the action of user pressing an edit_puzzle button"""
action_id = payload['actions'][0]['action_id']
"""Handler for the action of user pressing an edit_puzzle button"""
action_id = payload['actions'][0]['action_id']
- response_url = payload['response_url']
trigger_id = payload['trigger_id']
(hunt_id, sort_key) = action_id.split('-', 1)
trigger_id = payload['trigger_id']
(hunt_id, sort_key) = action_id.split('-', 1)
puzzle = find_puzzle_for_sort_key(turb, hunt_id, sort_key)
if not puzzle:
puzzle = find_puzzle_for_sort_key(turb, hunt_id, sort_key)
if not puzzle:
- requests.post(response_url,
- json = {"text": "Error: Puzzle not found!"},
- headers = {"Content-type": "application/json"})
return bot_reply("Error: Puzzle not found.")
return edit_puzzle(turb, puzzle, trigger_id)
return bot_reply("Error: Puzzle not found.")
return edit_puzzle(turb, puzzle, trigger_id)
"""Handler for the action of user pressing an edit_hunt button"""
hunt_id = payload['actions'][0]['action_id']
"""Handler for the action of user pressing an edit_hunt button"""
hunt_id = payload['actions'][0]['action_id']
- response_url = payload['response_url']
trigger_id = payload['trigger_id']
hunt = find_hunt_for_hunt_id(hunt_id)
if not hunt:
trigger_id = payload['trigger_id']
hunt = find_hunt_for_hunt_id(hunt_id)
if not hunt:
- requests.post(response_url,
- json = {"text": "Error: Hunt not found!"},
- headers = {"Content-type": "application/json"})
return bot_reply("Error: Hunt not found.")
return edit_hunt(turb, hunt, trigger_id)
return bot_reply("Error: Hunt not found.")
return edit_hunt(turb, hunt, trigger_id)