Fix !syncquotes

master
Nikola Forró 6 years ago
parent fa81d9f926
commit 41a0685ca6

@ -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):

Loading…
Cancel
Save