From 23b5a5db1c5b3e4033c1f5df71d318956c2a8628 Mon Sep 17 00:00:00 2001 From: Frisk Date: Thu, 24 Feb 2022 07:16:43 +0100 Subject: [PATCH] Added fix to possible None comparison on HTTP status check --- src/discord/queue.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/discord/queue.py b/src/discord/queue.py index dfa56f1..771507c 100644 --- a/src/discord/queue.py +++ b/src/discord/queue.py @@ -116,6 +116,9 @@ def handle_discord_http(code, formatted_embed, result): "Discord have trouble processing the event, and because the HTTP code returned is {} it means we blame them.".format( code)) return 3 + else: + logger.error("There was an unexpected HTTP code returned from Discord: {}".format(code)) + return 1 def update_ratelimit(request): @@ -183,5 +186,5 @@ def send_to_discord(data: Optional[DiscordMessage], meta: DiscordMessageMetadata elif code == 2: time.sleep(5.0) messagequeue.add_message((data, meta)) - elif code < 2: + elif code is None or code < 2: pass \ No newline at end of file