]> git.cworth.org Git - turbot/blobdiff - turbot/blocks.py
Add state string to list of puzzle attributes matched in searching
[turbot] / turbot / blocks.py
index a18c0558a072cb18e7284123b4311d55a2537916..661cff37287d0fbee5a9fddb37220f7c8ef17630 100644 (file)
@@ -1,3 +1,8 @@
+def divider_block():
+    return {
+        "type": "divider"
+    }
+
 def text_block(body):
     return {
         "text": {
@@ -47,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
+            ]
+        }
+    }