X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=turbot%2Finteraction.py;h=b22016107df99ae5127e4101d6cbe87abc0c4a3e;hb=7151e2b039f92dc9904dc4b9e77a22f2d089b020;hp=f9640ca3473b3abb8adc8e742b9065112c389158;hpb=e7ee7e4b0645c8a79bdd6e42fe517d8a5abaee11;p=turbot diff --git a/turbot/interaction.py b/turbot/interaction.py index f9640ca..b220161 100644 --- a/turbot/interaction.py +++ b/turbot/interaction.py @@ -160,6 +160,8 @@ def edit_puzzle(turb, puzzle, trigger_id): input_block("Puzzle URL", "url", "External URL of puzzle", initial_value=puzzle.get("url", None), optional=True), + checkbox_block("Is this a meta puzzle?", "Meta", "meta", + checked=(puzzle.get('type', 'plain') == 'meta')), * round_options_block, input_block("New round(s)", "new_rounds", "New round(s) this puzzle belongs to " + @@ -212,6 +214,10 @@ def edit_puzzle_submission(turb, payload, metadata): url = state['url']['url']['value'] if url: puzzle['url'] = url + if state['meta']['meta']['selected_options']: + puzzle['type'] = 'meta' + else: + puzzle['type'] = 'plain' rounds = [option['value'] for option in state['rounds']['rounds']['selected_options']] if rounds: @@ -686,6 +692,7 @@ def new_puzzle(turb, body): input_block("Puzzle name", "name", "Name of the puzzle"), input_block("Puzzle URL", "url", "External URL of puzzle", optional=True), + checkbox_block("Is this a meta puzzle?", "Meta", "meta"), * round_options_block, input_block("New round(s)", "new_rounds", "New round(s) this puzzle belongs to " + @@ -716,6 +723,10 @@ def new_puzzle_submission(turb, payload, metadata): state = payload['view']['state']['values'] name = state['name']['name']['value'] url = state['url']['url']['value'] + if state['meta']['meta']['selected_options']: + puzzle_type = 'meta' + else: + puzzle_type = 'plain' if 'rounds' in state: rounds = [option['value'] for option in state['rounds']['rounds']['selected_options']] @@ -774,6 +785,7 @@ def new_puzzle_submission(turb, payload, metadata): "solution": [], "status": 'unsolved', "name": name, + "type": puzzle_type } if url: item['url'] = url