X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=turbot%2Finteraction.py;h=94787b40fbc28e15c7773f0ca497b5dcf4bea1b9;hb=c6ad0733c2613b899a30291b14222ef6c322c6cb;hp=507da76741730f2944962b10306a1de42c2696d6;hpb=7d98a0d74781c4771907952b0a2dcaf06d638664;p=turbot diff --git a/turbot/interaction.py b/turbot/interaction.py index 507da76..94787b4 100644 --- a/turbot/interaction.py +++ b/turbot/interaction.py @@ -928,13 +928,20 @@ def new_puzzle(turb, body): return bot_reply("Sorry, this channel doesn't appear to " + "be a hunt or puzzle channel") + # We used puzzle (if available) to select the initial round(s) + puzzle = puzzle_for_channel(turb, channel_id) + initial_rounds = None + if puzzle: + initial_rounds=puzzle.get("rounds", None) + round_options = hunt_rounds(turb, hunt['hunt_id']) if len(round_options): round_options_block = [ multi_select_block("Round(s)", "rounds", "Existing round(s) this puzzle belongs to", - round_options) + round_options, + initial_options=initial_rounds) ] else: round_options_block = [] @@ -1262,10 +1269,11 @@ def hunt(turb, body, args): blocks = hunt_blocks(turb, hunt, puzzle_status=status, search_terms=terms) - requests.post(response_url, - json = { 'blocks': blocks }, - headers = {'Content-type': 'application/json'} - ) + for block in blocks: + requests.post(response_url, + json = { 'blocks': block }, + headers = {'Content-type': 'application/json'} + ) return lambda_ok @@ -1336,10 +1344,11 @@ def round(turb, body, args): limit_to_rounds=puzzle.get('rounds', []) ) - requests.post(response_url, - json = { 'blocks': blocks }, - headers = {'Content-type': 'application/json'} - ) + for block in blocks: + requests.post(response_url, + json = { 'blocks': block }, + headers = {'Content-type': 'application/json'} + ) return lambda_ok