Skip to content

Commit

Permalink
Fix datetime comparison
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
elliotgoodrich committed Feb 23, 2024
1 parent e6dee5e commit abd6a54
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions discord_handler/discord_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down Expand Up @@ -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})!")
Expand Down

0 comments on commit abd6a54

Please sign in to comment.