From abd6a54c4186f5e8728defac3538593dd7eff312 Mon Sep 17 00:00:00 2001 From: Elliot Goodrich Date: Fri, 23 Feb 2024 10:19:06 +0000 Subject: [PATCH] Fix datetime comparison In `/watch` we compare timezone-aware and non-timezone-aware `datetime` values, which results in a runtime exception. Instead of adding timezones to everything it is far simpler to remove the timezone in the 2 places we use it. --- discord_handler/discord_handler.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/discord_handler/discord_handler.py b/discord_handler/discord_handler.py index 8ffbf47..34a2c88 100644 --- a/discord_handler/discord_handler.py +++ b/discord_handler/discord_handler.py @@ -191,7 +191,7 @@ def handle_application_command(event, client): * /watch [FilmID] * /here """ - now = dt.datetime.now(dt.timezone.utc) + now = dt.datetime.now() body = event["body-json"] command = body["data"]["name"] guild_id = body["guild_id"] @@ -426,7 +426,7 @@ def handle_autocomplete(event, client): def handle_message_component(event, client): body = event["body-json"] - now = dt.datetime.now(dt.timezone.utc) + now = dt.datetime.now() component_type = body["data"]["component_type"] if component_type != DiscordMessageComponent.BUTTON: raise Exception(f"Unknown message component ({component_type})!")