]> git.cworth.org Git - turbot/blobdiff - turbot/blocks.py
Add a multi-select round field to puzzle creation
[turbot] / turbot / blocks.py
index 27e69f4d6d9d61140a16e4fa71cd30fcfe9d75e3..661cff37287d0fbee5a9fddb37220f7c8ef17630 100644 (file)
@@ -52,3 +52,30 @@ def input_block(label, name, placeholder, optional=False):
             "text": label
         }
     }
+
+def multi_select_block(label, name, placeholder, options, default=None):
+    return {
+        "type": "section",
+        "block_id": name,
+        "text": {
+            "type": "mrkdwn",
+            "text": "*{}*".format(label)
+        },
+        "accessory": {
+            "action_id": name,
+            "type": "multi_static_select",
+            "placeholder": {
+                "type": "plain_text",
+                "text": placeholder
+            },
+            "options": [
+                {
+                    "text": {
+                        "type": "plain_text",
+                        "text": option
+                    },
+                    "value": option
+                } for option in options
+            ]
+        }
+    }