|
|
@ -68,15 +68,15 @@ class ReplayBot(irc.bot.SingleServerIRCBot):
|
|
|
|
message = ''.join([c for c in event.arguments[0] if not unicodedata.category(c).startswith('C')])
|
|
|
|
message = ''.join([c for c in event.arguments[0] if not unicodedata.category(c).startswith('C')])
|
|
|
|
message = message.rstrip()
|
|
|
|
message = message.rstrip()
|
|
|
|
send_response = functools.partial(self._send_response, connection, event)
|
|
|
|
send_response = functools.partial(self._send_response, connection, event)
|
|
|
|
if int(tags['user-id']) != self.control_user:
|
|
|
|
|
|
|
|
send_response('Sorry @{0}, you are not allowed to do this'.format(tags['display-name']))
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
for pattern, action in self.supported_commands:
|
|
|
|
for pattern, action in self.supported_commands:
|
|
|
|
m = pattern.match(message)
|
|
|
|
m = pattern.match(message)
|
|
|
|
if m:
|
|
|
|
if m:
|
|
|
|
action(tags, send_response, **m.groupdict())
|
|
|
|
action(tags, send_response, **m.groupdict())
|
|
|
|
|
|
|
|
|
|
|
|
def _do_load(self, tags, send_response, id, **kwargs):
|
|
|
|
def _do_load(self, tags, send_response, id, **kwargs):
|
|
|
|
|
|
|
|
if int(tags['user-id']) != self.control_user:
|
|
|
|
|
|
|
|
send_response('Sorry @{0}, you are not allowed to do this'.format(tags['display-name']))
|
|
|
|
|
|
|
|
return
|
|
|
|
client_id = self.config['Twitch'].get('client_id')
|
|
|
|
client_id = self.config['Twitch'].get('client_id')
|
|
|
|
def get_comments(cursor):
|
|
|
|
def get_comments(cursor):
|
|
|
|
url = 'https://api.twitch.tv/v5/videos/{0}/comments'.format(id)
|
|
|
|
url = 'https://api.twitch.tv/v5/videos/{0}/comments'.format(id)
|
|
|
@ -103,6 +103,9 @@ class ReplayBot(irc.bot.SingleServerIRCBot):
|
|
|
|
send_response('@{0}: failed to load messages'.format(tags['display-name']))
|
|
|
|
send_response('@{0}: failed to load messages'.format(tags['display-name']))
|
|
|
|
|
|
|
|
|
|
|
|
def _do_start(self, tags, send_response, **kwargs):
|
|
|
|
def _do_start(self, tags, send_response, **kwargs):
|
|
|
|
|
|
|
|
if int(tags['user-id']) != self.control_user:
|
|
|
|
|
|
|
|
send_response('Sorry @{0}, you are not allowed to do this'.format(tags['display-name']))
|
|
|
|
|
|
|
|
return
|
|
|
|
now = datetime.datetime.utcnow().replace(tzinfo=datetime.timezone.utc)
|
|
|
|
now = datetime.datetime.utcnow().replace(tzinfo=datetime.timezone.utc)
|
|
|
|
for offset, user, msg in self.messages:
|
|
|
|
for offset, user, msg in self.messages:
|
|
|
|
def cb(user=user, msg=msg):
|
|
|
|
def cb(user=user, msg=msg):
|
|
|
@ -110,6 +113,9 @@ class ReplayBot(irc.bot.SingleServerIRCBot):
|
|
|
|
self.reactor.scheduler.execute_at(now + offset, cb)
|
|
|
|
self.reactor.scheduler.execute_at(now + offset, cb)
|
|
|
|
|
|
|
|
|
|
|
|
def _do_stop(self, tags, send_response, **kwargs):
|
|
|
|
def _do_stop(self, tags, send_response, **kwargs):
|
|
|
|
|
|
|
|
if int(tags['user-id']) != self.control_user:
|
|
|
|
|
|
|
|
send_response('Sorry @{0}, you are not allowed to do this'.format(tags['display-name']))
|
|
|
|
|
|
|
|
return
|
|
|
|
self.reactor.scheduler.queue.clear()
|
|
|
|
self.reactor.scheduler.queue.clear()
|
|
|
|
|
|
|
|
|
|
|
|
def _post_message(self, user, msg):
|
|
|
|
def _post_message(self, user, msg):
|
|
|
|