From f03e20318f52f3682c9173c0cade49ded9a44c88 Mon Sep 17 00:00:00 2001 From: Yee Jia Rong <28086837+fourjr@users.noreply.github.com> Date: Tue, 19 Apr 2022 23:43:45 +0800 Subject: [PATCH] fix blocked, resolve #3131 --- CHANGELOG.md | 1 + bot.py | 1 - cogs/modmail.py | 4 +++- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 209bbcfcea..fb025baca2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,6 +44,7 @@ however, insignificant breaking changes do not guarantee a major version bump, s - Editing notes now work. ([GH #3094](https://github.com/kyb3r/modmail/issues/3094)) - Commands now work in threads. - Audit log searching now properly works. +- Old data causing `?blocked` to fail. ([GH #3131](https://github.com/kyb3r/modmail/issues/3131)) ### Internal diff --git a/bot.py b/bot.py index 6c0719243b..da1e7117a3 100644 --- a/bot.py +++ b/bot.py @@ -6,7 +6,6 @@ import logging import os import re -import signal import string import struct import sys diff --git a/cogs/modmail.py b/cogs/modmail.py index 8ef853963c..63997b2824 100644 --- a/cogs/modmail.py +++ b/cogs/modmail.py @@ -1565,7 +1565,9 @@ async def blocked(self, ctx): ) if end_time is not None: - after = (datetime.fromisoformat(end_time.group(1)) - now).total_seconds() + after = ( + datetime.fromisoformat(end_time.group(1)).replace(tzinfo=timezone.utc) - now + ).total_seconds() if after <= 0: # No longer blocked self.bot.blocked_users.pop(str(id_))