def start(self):
if self.mode == 'slacker':
exit('Slacker mode is missing websocket for reading events... sorry!')
if self.slack.rtm.connect().body.get('ok'):
print("[+] SecBot connected and running!")
ch_joiner = self.join_channels()
while True:
channel, user, ts, message, at_bot = self.parse_slack_output(self.slack.rtm.read())
if message and channel:
self.executor.submit(self.handle_command, channel, user, ts, message, at_bot)
#self.handle_command(channel, user, ts, message, at_bot)
time.sleep(self.websocket_delay)
if self.mode == 'slackclient':
if self.slack.rtm_connect(no_latest=True, no_unreads=True, presence_sub=True):
print("[+] SecBot connected and running!")
ch_joiner = self.join_channels()
while True:
channel, user, ts, message, at_bot = self.parse_slack_output(self.slack.rtm_read())
if message and channel:
self.executor.submit(self.handle_command, channel, user, ts, message, at_bot)
#self.handle_command(channel, user, ts, message, at_bot)
time.sleep(self.websocket_delay)
else:
print("[!] Connection failed. Invalid Slack token or bot ID?")
评论列表
文章目录