From 72bfeb19b5019d5a2a3fa8647df7df02f753f98e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Forr=C3=B3?= Date: Thu, 26 Apr 2018 13:31:51 +0200 Subject: [PATCH] Enhance quote matching regex --- api/sync_with_twitch.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/sync_with_twitch.py b/api/sync_with_twitch.py index 1219965..6148449 100644 --- a/api/sync_with_twitch.py +++ b/api/sync_with_twitch.py @@ -67,7 +67,7 @@ def main(): if last: videos = [v for v in videos if v['date'] >= last.date] last_id = last.id - QUOTE = re.compile(r'^\!quote\s+add\s+(.+)$') + QUOTE = re.compile(r'^\!quote\s+add\s+(?P")?(?P.+)(?(q)")$') quotes = [] for video in videos: app.logger.info('Processing video %d (%s)', video['id'], video['title']) @@ -76,7 +76,7 @@ def main(): m = QUOTE.match(comment) if m: quotes.append(dict( - text=m.group(1), + text=m.group('text'), video_id=video['id'], game=video['game'], date=video['date']))