diff --git a/mastochess.py b/mastochess.py index 91710d4..bc7dd35 100644 --- a/mastochess.py +++ b/mastochess.py @@ -4,6 +4,7 @@ import os.path import re import unidecode from datetime import datetime, timedelta +import time from mastodon import Mastodon from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText @@ -241,11 +242,19 @@ def get_piece_name(captured_piece): return piece_name def get_mentions(): - + account_id_lst = [] status_id_lst = [] + if time.localtime().tm_isdst == 0: + + interval_time = '60 minutes' + + elif time.localtime().tm_isdst == 1: + + interval_time = '120 minutes' + conn = None try: @@ -254,7 +263,7 @@ def get_mentions(): cur = conn.cursor() - select_query = "select account_id, id from statuses where created_at + interval '60 minutes' > now() - interval '5 minutes'" + select_query = "select account_id, id from statuses where created_at + interval '" + interval_time + "' > now() - interval '5 minutes'" select_query += " and id=any (select status_id from mentions where account_id=(%s)) order by created_at asc" cur.execute(select_query, (str(bot_id),))