aboutsummaryrefslogtreecommitdiffstats
path: root/bot/exts/utilities/wolfram.py
diff options
context:
space:
mode:
authorGravatar Xithrius <[email protected]>2022-11-02 02:07:29 -0700
committerGravatar GitHub <[email protected]>2022-11-02 02:07:29 -0700
commit43a2acf5ee4eb354ce3dfaeef9504eee9b9b46b4 (patch)
treecbdfeb08f8d582aa98acec6a529f0fa3dcd7933c /bot/exts/utilities/wolfram.py
parentAppeased the formatter (diff)
parentMerge pull request #1137 from DivyanshuBist/bug-issue1122-message-of-type-None (diff)
Merge branch 'main' into main
Diffstat (limited to 'bot/exts/utilities/wolfram.py')
-rw-r--r--bot/exts/utilities/wolfram.py17
1 files changed, 15 insertions, 2 deletions
diff --git a/bot/exts/utilities/wolfram.py b/bot/exts/utilities/wolfram.py
index 9a26e545..a2f1228a 100644
--- a/bot/exts/utilities/wolfram.py
+++ b/bot/exts/utilities/wolfram.py
@@ -202,6 +202,13 @@ class Wolfram(Cog):
message = "Wolfram API key is invalid or missing."
footer = ""
color = Colours.soft_red
+ elif status != 200:
+ # Handle all other possible status codes here
+ message = f"Unexpected status code from Wolfram API: {status}"
+ footer = ""
+ color = Colours.soft_red
+
+ log.warning(f"Unexpected status code from Wolfram API: {status}\nInput: {query}")
else:
message = ""
footer = "View original for a bigger picture."
@@ -281,6 +288,12 @@ class Wolfram(Cog):
elif response_text == "Error 1: Invalid appid.":
message = "Wolfram API key is invalid or missing."
color = Colours.soft_red
+ elif status != 200:
+ # Handle all other possible status codes here
+ message = f"Unexpected status code from Wolfram API: {status}"
+ color = Colours.soft_red
+
+ log.warning(f"Unexpected status code from Wolfram API: {status}\nInput: {query}")
else:
message = response_text
color = Colours.soft_orange
@@ -288,6 +301,6 @@ class Wolfram(Cog):
await send_embed(ctx, message, color)
-def setup(bot: Bot) -> None:
+async def setup(bot: Bot) -> None:
"""Load the Wolfram cog."""
- bot.add_cog(Wolfram(bot))
+ await bot.add_cog(Wolfram(bot))