|
|
@ -81,6 +81,7 @@ class ReplayBot(irc.bot.SingleServerIRCBot):
|
|
|
|
send_response('Sorry @{0}, you are not allowed to do this'.format(tags['display-name']))
|
|
|
|
send_response('Sorry @{0}, you are not allowed to do this'.format(tags['display-name']))
|
|
|
|
return
|
|
|
|
return
|
|
|
|
client_id = self.config['Twitch'].get('client_id')
|
|
|
|
client_id = self.config['Twitch'].get('client_id')
|
|
|
|
|
|
|
|
user_blacklist = self.config['Rerun'].get('user_blacklist').split(',')
|
|
|
|
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)
|
|
|
|
params = dict(client_id=client_id, cursor=cursor)
|
|
|
|
params = dict(client_id=client_id, cursor=cursor)
|
|
|
@ -92,6 +93,8 @@ class ReplayBot(irc.bot.SingleServerIRCBot):
|
|
|
|
while True:
|
|
|
|
while True:
|
|
|
|
data = get_comments(cursor)
|
|
|
|
data = get_comments(cursor)
|
|
|
|
for comment in data.get('comments', []):
|
|
|
|
for comment in data.get('comments', []):
|
|
|
|
|
|
|
|
if comment['commenter']['_id'] in user_blacklist:
|
|
|
|
|
|
|
|
continue
|
|
|
|
self.messages.append((
|
|
|
|
self.messages.append((
|
|
|
|
datetime.timedelta(seconds=float(comment['content_offset_seconds'])),
|
|
|
|
datetime.timedelta(seconds=float(comment['content_offset_seconds'])),
|
|
|
|
comment['commenter']['display_name'],
|
|
|
|
comment['commenter']['display_name'],
|
|
|
@ -149,7 +152,8 @@ class ReplayBot(irc.bot.SingleServerIRCBot):
|
|
|
|
self.reactor.scheduler.queue.clear()
|
|
|
|
self.reactor.scheduler.queue.clear()
|
|
|
|
|
|
|
|
|
|
|
|
def _post_message(self, user, msg):
|
|
|
|
def _post_message(self, user, msg):
|
|
|
|
self.connection.privmsg(self.output_channel, '[{0}]: {1}'.format(user, msg))
|
|
|
|
text = self.config['Rerun'].get('message_template').format(username=user, message=msg)
|
|
|
|
|
|
|
|
self.connection.privmsg(self.output_channel, text)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def main():
|
|
|
|
def main():
|
|
|
|