-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbot.py
More file actions
31 lines (27 loc) · 761 Bytes
/
bot.py
File metadata and controls
31 lines (27 loc) · 761 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
30
31
#!/usr/bin/env python
import os
import sys
import logging
import logging.config
from slackbot import settings
from slackbot import dispatcher
from slackbot.bot import Bot
# monkey patch slackbot -__-
def new_filter(self, msg):
text = msg.get('text', '')
msg['text'] = text
return msg
dispatcher.MessageDispatcher.filter_text = new_filter
def main():
kw = {
'format': '[%(asctime)s] %(message)s',
'datefmt': '%m/%d/%Y %H:%M:%S',
'level': logging.DEBUG,
'stream': sys.stdout,
}
logging.basicConfig(**kw)
logging.getLogger('requests.packages.urllib3.connectionpool').setLevel(logging.DEBUG)
settings.API_TOKEN = os.environ['SLACK_API_TOKEN']
Bot().run()
if __name__ == '__main__':
main()