|
|
@ -45,7 +45,7 @@ class TwitchClient(irc.bot.SingleServerIRCBot):
|
|
|
|
self.supported_commands = [
|
|
|
|
self.supported_commands = [
|
|
|
|
(re.compile(r'^!lastquote$'), self._do_lastquote),
|
|
|
|
(re.compile(r'^!lastquote$'), self._do_lastquote),
|
|
|
|
(re.compile(r'^!findquote\s+(?P<q>")?(?P<filter>.+)(?(q)")$'), self._do_findquote),
|
|
|
|
(re.compile(r'^!findquote\s+(?P<q>")?(?P<filter>.+)(?(q)")$'), self._do_findquote),
|
|
|
|
(re.compile(r'^!sync(\s+(?P<since>.+))?$'), self._do_sync),
|
|
|
|
(re.compile(r'^!syncquotes$'), self._do_syncquotes),
|
|
|
|
(re.compile(r'^!(bella(gram|pics)|insta(gram|bella))$'), self._do_bellagram),
|
|
|
|
(re.compile(r'^!(bella(gram|pics)|insta(gram|bella))$'), self._do_bellagram),
|
|
|
|
(re.compile(r'^!yt\s+(?P<q>")?(?P<query>.+)(?(q)")$'), self._do_yt),
|
|
|
|
(re.compile(r'^!yt\s+(?P<q>")?(?P<query>.+)(?(q)")$'), self._do_yt),
|
|
|
|
]
|
|
|
|
]
|
|
|
@ -137,13 +137,13 @@ class TwitchClient(irc.bot.SingleServerIRCBot):
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
send_response('!quote {0}'.format(quote['id']))
|
|
|
|
send_response('!quote {0}'.format(quote['id']))
|
|
|
|
|
|
|
|
|
|
|
|
def _do_sync(self, tags, send_response, since=None, **kwargs):
|
|
|
|
def _do_syncquotes(self, tags, send_response, **kwargs):
|
|
|
|
master_user_id = self.config['Twitch'].getint('master_user_id')
|
|
|
|
master_user_id = self.config['Twitch'].getint('master_user_id')
|
|
|
|
if int(tags['user-id']) != self.master_user_id:
|
|
|
|
if int(tags['user-id']) != master_user_id:
|
|
|
|
respond('Sorry @{0}, you are not allowed to do this'.format(tags['display-name']))
|
|
|
|
respond('Sorry @{0}, you are not allowed to do this'.format(tags['display-name']))
|
|
|
|
return
|
|
|
|
return
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
messages = self.commands.get_twitch_messages(since)
|
|
|
|
messages = self.commands.get_twitch_messages()
|
|
|
|
except CommandError as e:
|
|
|
|
except CommandError as e:
|
|
|
|
self.logger.error('Failed to get Twitch messages: %s', e)
|
|
|
|
self.logger.error('Failed to get Twitch messages: %s', e)
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|