From: CMDR furrycat Date: Tue, 4 Oct 2016 09:20:17 +0000 (+0100) Subject: Announce if start and end dates are the same, so a one-time scheduled announcement... X-Git-Url: http://git.furryclan.net/?a=commitdiff_plain;h=aca5ac5d2a909c30b9a003551552b6c1ab9d0971;p=furrycat%2Fcatbot.git Announce if start and end dates are the same, so a one-time scheduled announcement is possible. --- diff --git a/db.py b/db.py index c565ce7..a0e32d6 100644 --- a/db.py +++ b/db.py @@ -60,7 +60,7 @@ class DBConnection(object): def get_announcements(self, client): now = self.now() - cursor = self.query('select id, server_id, channel_id, voice_id, sound, mention, start_date, end_date, interval, probability, last_spoke, message, digest from announcements where (start_date is null or start_date <= ?) and (end_date is null or end_date > ?) and (last_spoke is null or last_spoke < ? - interval) and bot_id=?', [now, now, now, client.user.id]) + cursor = self.query('select id, server_id, channel_id, voice_id, sound, mention, start_date, end_date, interval, probability, last_spoke, message, digest from announcements where (start_date is null or start_date <= ?) and (end_date is null or end_date > ? or end_date=start_date) and (last_spoke is null or last_spoke < ? - interval) and bot_id=?', [now, now, now, client.user.id]) for row in cursor.fetchall(): yield dict(row)