def __init__(self, sc, bridge_nick, nickserv_pw, slack_uid, channels,
user_bots):
self.sc = sc
self.user_bots = user_bots
self.nickserv_password = nickserv_pw
self.slack_uid = slack_uid
self.users = {bot.user_id: bot for bot in user_bots}
self.channels = {channel['id']: channel for channel in channels}
self.channel_name_uid_map = {channel['name']: channel['id']
for channel in channels}
self.nickname = bridge_nick
self.message_queue = queue.PriorityQueue()
self.rtm_connect()
log.msg('Connected successfully to Slack RTM')
# Create a looping call to poll Slack for updates
rtm_loop = LoopingCall(self.check_slack_rtm)
# Slack's rate limit is 1 request per second, so set this to something
# greater than or equal to that to avoid problems
rtm_loop.start(1)
# Create another looping call which acts on messages in the queue
message_loop = LoopingCall(self.empty_queue)
message_loop.start(0.5)
评论列表
文章目录