+def divider_block():
+ return {
+ "type": "divider"
+ }
+
def text_block(body):
return {
"text": {
"value": name
}
-def input_block(label, name, placeholder):
+def accessory_block(main, accessory):
+ return {
+ **main,
+ "accessory": {
+ **accessory
+ }
+ }
+
+def input_block(label, name, placeholder, optional=False):
return {
"type": "input",
"block_id": name,
+ "optional": optional,
"element": {
"type": "plain_text_input",
"action_id": name,
"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
+ ]
+ }
+ }