|
|
@ -67,12 +67,12 @@ class TwitchBot(irc.bot.SingleServerIRCBot):
|
|
|
|
|
|
|
|
|
|
|
|
def process_message(self, connection, event):
|
|
|
|
def process_message(self, connection, event):
|
|
|
|
sources = [t['value'] for t in event.tags if t['key'] == 'display-name']
|
|
|
|
sources = [t['value'] for t in event.tags if t['key'] == 'display-name']
|
|
|
|
source = sources.pop()
|
|
|
|
|
|
|
|
message = ''.join([c for c in event.arguments[0] if c in string.printable])
|
|
|
|
message = ''.join([c for c in event.arguments[0] if c in string.printable])
|
|
|
|
|
|
|
|
message = message.rstrip()
|
|
|
|
for pattern, action in self.actions:
|
|
|
|
for pattern, action in self.actions:
|
|
|
|
m = pattern.match(message)
|
|
|
|
m = pattern.match(message)
|
|
|
|
if m:
|
|
|
|
if m:
|
|
|
|
action(connection, source, **m.groupdict())
|
|
|
|
action(connection, sources[0], **m.groupdict())
|
|
|
|
|
|
|
|
|
|
|
|
def get(self, params):
|
|
|
|
def get(self, params):
|
|
|
|
r = requests.get('{0}/quotes'.format(self.api_url), params=params)
|
|
|
|
r = requests.get('{0}/quotes'.format(self.api_url), params=params)
|
|
|
|