forked from aeranghang/slackbot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
29 lines (24 loc) · 642 Bytes
/
Copy pathmain.py
File metadata and controls
29 lines (24 loc) · 642 Bytes
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
from rtmbot import RtmBot
from rtmbot.core import Plugin
import secret
def answer(text):
if "채원" in text:
reply = "불렀어??"
elif "주사위" == text:
reply = str(random.randint(1, 6))
elif "민경" in text:
reply = "피글렛?"
else:
reply = None
return reply
class HelloPlugin(Plugin):
def process_message(self, data):
reply = answer(data["text"])
if reply is not None:
self.outputs.append([data["channel"], reply])
config = {
"SLACK_TOKEN": secret.SLACK_TOKEN,
"ACTIVE_PLUGINS": ["main.HelloPlugin"]
}
bot = RtmBot(config)
bot.start()