We've now got another handoff, from the puzzle modal's submission
handler to a separate channel_created event before the hunt's
channel_id is needed. And by then we've lost the context of this
private_metadata, (so the current code scans through the database
'hunts' table to find the ID). Given all that, we can drop this unused
field from the metadata.
"type": "modal",
"private_metadata": json.dumps({
"hunt_id": hunt_id,
- "hunt_channel_id": channel_id
}),
"title": {"type": "plain_text", "text": "New Puzzle"},
"submit": { "type": "plain_text", "text": "Create" },
meta = json.loads(metadata)
hunt_id = meta['hunt_id']
- hunt_channel_id = meta['hunt_channel_id']
state = payload['view']['state']['values']
name = state['name']['name']['value']