-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathslack.py
More file actions
126 lines (97 loc) Β· 4.22 KB
/
Copy pathslack.py
File metadata and controls
126 lines (97 loc) Β· 4.22 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
from django.urls import reverse
from slacker import Slacker
from constance import config
token = config.SLACK_TOKEN
CFP_CHANNEL = config.SLACK_CHANNEL
CFS_CHANNEL = config.CFS_NOTI_CHANNEL
SLACK_INVITATION_ALARM_CHANNEL = config.SLACK_INVITATION_ALARM_CHANNEL
def new_cfp_registered(hostname, pk, title):
if token:
slack = Slacker(token)
text = 'μλ
, λλ μλ €μ£ΌκΈΈ μ’μνλ CFP-BOT! CFPμ λ°λ κ² μμ΄ AWSμμ λ°λΌμμ§!'
url = hostname + reverse('admin:program_proposal_change', args=(pk,))
attachment = {
"color": 'good',
"title": 'μλ‘μ΄ CFPκ° λ±λ‘λμμ΅λλ€. :)',
"text": 'μ λͺ©: {}\n μ£Όμ: {}'.format(title, url),
}
slack.chat.post_message(
CFP_CHANNEL, text=text, attachments=[attachment],
username='cfp-bot', icon_emoji=':female_mage:')
def cfp_updated(hostname, pk, title):
if token:
slack = Slacker(token)
text = 'μλ
, λλ μλ €μ£ΌκΈΈ μ’μνλ CFP-BOT! CFPμ λ°λ κ² μμ΄ AWSμμ λ°λΌμμ§!'
url = hostname + reverse('admin:program_proposal_change', args=(pk,))
attachment = {
"color": 'good',
"title": 'μμ λ CFPκ° μμ΅λλ€. :)',
"text": 'μ λͺ©: {}\n μ£Όμ: {}'.format(title, url),
}
slack.chat.post_message(
CFP_CHANNEL, text=text, attachments=[attachment], icon_emoji=':female_mage:'
)
def new_cfs_registered(hostname, pk, title):
if token:
slack = Slacker(token)
text = 'μλ
, λλ μλ €μ£ΌκΈΈ μ’μνλ CFS-BOT! μλ‘μ΄ μ€ν°μ μ μ²μ΄ μμ΄ AWSμμ λ°λΌμμ§!'
url = hostname + reverse('admin:sponsor_sponsor_change', args=(pk,))
attachment = {
"color": 'good',
"title": 'μλ‘μ΄ CFSκ° λ±λ‘λμμ΅λλ€. :)',
"text": 'μ€ν°μ μ΄λ¦: {}\n μ£Όμ: {}'.format(title, url),
}
slack.chat.post_message(
CFS_CHANNEL, text=text, attachments=[attachment],
username='cfs-bot', icon_emoji=':female_mage:')
def cfs_updated(hostname, pk, title):
if token:
slack = Slacker(token)
text = 'μλ
, λλ μλ €μ£ΌκΈΈ μ’μνλ CFS-BOT! μ μ²ν μ€ν°μ λ΄μ© μ€ λ°λκ² μμ΄ AWSμμ λ°λΌμμ§!'
url = hostname + reverse('admin:sponsor_sponsor_change', args=(pk,))
attachment = {
"color": 'good',
"title": 'μμ λ CFSκ° μμ΅λλ€. :)',
"text": 'μ€ν°μ μ΄λ¦: {}\n μ£Όμ: {}'.format(title, url),
}
slack.chat.post_message(
CFS_CHANNEL, text=text, attachments=[attachment], icon_emoji=':female_mage:'
)
def program_updated(hostname, pk, title):
if token:
slack = Slacker(token)
text = 'λ°ν μκ°κ° μ
λ°μ΄νΈ λμμ΄μ!'
url = hostname + reverse('talk', kwargs={'pk': pk})
attachment = {
"color": 'good',
"title": 'μμ λ λ°ν μκ°',
"text": 'λ°ν μ λͺ©: {}\n μ£Όμ: {}'.format(title, url),
}
slack.chat.post_message(
CFP_CHANNEL, text=text, attachments=[attachment], icon_emoji=':female_mage:'
)
def virtual_booth_updated(hostname, slug, name):
if token:
slack = Slacker(token)
text = 'Virtual boothκ° μ
λ°μ΄νΈ λμμ΄μ!'
url = hostname + reverse('virtual_booth', kwargs={'slug': slug})
attachment = {
"color": 'good',
"title": 'μμ λ virtual booth',
"text": 'νμμ¬: {}\n μ£Όμ: {}'.format(name, url),
}
slack.chat.post_message(
CFS_CHANNEL, text=text, attachments=[attachment], icon_emoji=':female_mage:'
)
def slack_invitation_request(email):
if token:
slack = Slacker(token)
text = 'μλ‘κ² μ μ²λ Slack κ°μ
μμ²μ΄ μμ΄μ!'
attachment = {
"color": 'good',
"title": 'Slack κ°μ
μμ²',
"text": 'μ΄λ©μΌ: {}'.format(email),
}
slack.chat.post_message(
SLACK_INVITATION_ALARM_CHANNEL, text=text, attachments=[attachment], icon_emoji=':female_mage:'
)