]> git.cworth.org Git - turbot/blob - turbot/blocks.py
Handle the submission of the "New Hunt" modal
[turbot] / turbot / blocks.py
1 def text_block(body):
2     return {
3         "text": {
4             "type": "mrkdwn",
5             "text": body
6         }
7     }
8
9 def section_block(block):
10     return {
11         "type": "section",
12         **block
13     }
14
15 def actions_block(*elements):
16     return {
17         "type": "actions",
18         "elements": list(elements)
19     }
20
21 def button_block(label, name):
22     return {
23         "type": "button",
24         "text": {
25             "type": "plain_text",
26             "text": label,
27             "emoji": True
28         },
29         "value": name
30     }
31
32 def input_block(label, name, placeholder):
33     return {
34         "type": "input",
35         "block_id": name,
36         "element": {
37             "type": "plain_text_input",
38             "action_id": name,
39             "placeholder": {
40                 "type": "plain_text",
41                 "text": placeholder,
42             }
43         },
44         "label": {
45             "type": "plain_text",
46             "text": label
47         }
48     }