From a5f92cd6066d082c07699f460948af547f2922dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Forr=C3=B3?= Date: Sun, 29 Apr 2018 15:09:42 +0200 Subject: [PATCH] Strip chat message before further processing --- bot.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bot.py b/bot.py index 9d60ade..5007aed 100644 --- a/bot.py +++ b/bot.py @@ -67,12 +67,12 @@ class TwitchBot(irc.bot.SingleServerIRCBot): def process_message(self, connection, event): 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 = message.rstrip() for pattern, action in self.actions: m = pattern.match(message) if m: - action(connection, source, **m.groupdict()) + action(connection, sources[0], **m.groupdict()) def get(self, params): r = requests.get('{0}/quotes'.format(self.api_url), params=params)