Allow multiple control users

master
Nikola Forró 7 years ago
parent 56b62c50d5
commit 4438126fd7

@ -32,7 +32,7 @@ class ReplayBot(irc.bot.SingleServerIRCBot):
self.output_channel = '#{0}'.format(self.config['IRC'].get('output_channel'))
control_channel = self.config['IRC'].get('control_channel')
self.control_channel = '#{0}'.format(control_channel) if control_channel else None
self.control_user = self.config['IRC'].getint('control_user')
self.control_users = self.config['IRC'].get('control_users').split(',')
server = self.config['IRC'].get('server')
port = self.config['IRC'].getint('port')
nickname = self.config['IRC'].get('nickname')
@ -77,7 +77,7 @@ class ReplayBot(irc.bot.SingleServerIRCBot):
action(tags, send_response, **m.groupdict())
def _do_load(self, tags, send_response, id, **kwargs):
if int(tags['user-id']) != self.control_user:
if tags['user-id'] not in self.control_users:
send_response('Sorry @{0}, you are not allowed to do this'.format(tags['display-name']))
return
client_id = self.config['Twitch'].get('client_id')
@ -106,7 +106,7 @@ class ReplayBot(irc.bot.SingleServerIRCBot):
send_response('@{0}: failed to load messages'.format(tags['display-name']))
def _do_start(self, tags, send_response, at=None, **kwargs):
if int(tags['user-id']) != self.control_user:
if tags['user-id'] not in self.control_users:
send_response('Sorry @{0}, you are not allowed to do this'.format(tags['display-name']))
return
if at is None:
@ -119,7 +119,7 @@ class ReplayBot(irc.bot.SingleServerIRCBot):
self.reactor.scheduler.execute_at(t + offset, cb)
def _do_resync(self, tags, send_response, offset, **kwargs):
if int(tags['user-id']) != self.control_user:
if tags['user-id'] not in self.control_users:
send_response('Sorry @{0}, you are not allowed to do this'.format(tags['display-name']))
return
offset = datetime.timedelta(seconds=float(offset))
@ -131,7 +131,7 @@ class ReplayBot(irc.bot.SingleServerIRCBot):
self.reactor.scheduler.queue[i] = ndc
def _do_stop(self, tags, send_response, **kwargs):
if int(tags['user-id']) != self.control_user:
if tags['user-id'] not in self.control_users:
send_response('Sorry @{0}, you are not allowed to do this'.format(tags['display-name']))
return
with self.reactor.mutex:

@ -3,7 +3,7 @@ server = irc.chat.twitch.tv
port = 6667
nickname = __BOT_NICKNAME__
output_channel = __OUTPUT_CHANNEL__
control_user = __CONTROL_USER_ID__
control_users = __CONTROL_USER_ID__,...
control_channel = __CONTROL_CHANNEL__
[Twitch]

Loading…
Cancel
Save