-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathblocks.py
More file actions
98 lines (92 loc) · 2.25 KB
/
blocks.py
File metadata and controls
98 lines (92 loc) · 2.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
LEARN_OR_TEACH = [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Hi! I'm *Botsy*! Would you like to *learn* or *teach*?"
}
},
{
"type": "divider"
},
{
"type": "actions",
"elements": [
{
"type": "button",
"text": {
"type": "plain_text",
"text": "Learn"
},
"value": "learnBlock"
},
{
"type": "button",
"text": {
"type": "plain_text",
"text": "Teach"
},
"value": "teachBlock"
}
]
}
]
TEACH_FORM = {
"title": "Teach",
'callback_id': 'teach_dialog04435',
"submit_label": "Submit",
"state": "Teach",
'elements':
[
{'name': 'teach_topic',
'label': 'What topic would you like to teach?',
'type': 'text',
'placeholder': 'Cats!'}
]
}
LEARN_FORM = {
"title": "Learn",
'callback_id': 'learn_dialog04435',
"submit_label": "Submit",
"state": "Learn",
'elements':
[
{'name': 'learn_topic',
'label': 'What topic would you like to learn about?',
'type': 'text',
'placeholder': 'Cats!'}
]
}
def generate_teacher_request_block(topic):
return [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": f"Hi <!channel>! Can anyone help teach *{topic}*? We've got someone who wants to learn."
}
},
{
"type": "actions",
"elements": [
{
"type": "button",
"text": {
"type": "plain_text",
"text": "I Can!"
},
"value": f"volunteerBlock__{topic}"
}
]
}
]
def generate_join_block(topic, teacher):
return [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": f"Hi! Who wants to learn about *{topic}*? @{teacher} wants to teach! Please emoji if you're interested, and we'll get you connected."
}
}
]