From 41a0685ca60062aabb68d5c5aadefc2daebb406e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Forr=C3=B3?= Date: Fri, 3 Aug 2018 11:28:38 +0200 Subject: [PATCH] Fix !syncquotes --- commands.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/commands.py b/commands.py index c824ff4..0554a58 100644 --- a/commands.py +++ b/commands.py @@ -1,3 +1,4 @@ +import datetime import random import dateutil.parser @@ -50,10 +51,13 @@ class Commands(object): try: messages = self._get_messages(dict( commenter='bellateeny', - term='quote')) + term='quote')).json() except requests.exceptions.HTTPError as e: raise CommandError(e) else: + # quotes before this date can have wrong IDs + threshold = datetime.datetime(2018, 5, 11) + messages = [m for m in messages if dateutil.parser.parse(m['created_at']) >= threshold] return [m.get('message_body', '') for m in messages] def last_quote(self):