From 2993a3e13bf1eb939bf4ac451ffe19b64a30709a Mon Sep 17 00:00:00 2001 From: Chris Lovering Date: Tue, 23 Aug 2022 21:38:49 +0100 Subject: Support discord.py's new async cog loading --- bot/exts/utilities/wolfram.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'bot/exts/utilities/wolfram.py') diff --git a/bot/exts/utilities/wolfram.py b/bot/exts/utilities/wolfram.py index 9a26e545..984431f0 100644 --- a/bot/exts/utilities/wolfram.py +++ b/bot/exts/utilities/wolfram.py @@ -288,6 +288,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)) -- cgit v1.2.3 From 19384dca56863dcfedd413c8cec4c689a3145793 Mon Sep 17 00:00:00 2001 From: Karlis Suvi <45097959+ks129@users.noreply.github.com> Date: Sat, 29 Oct 2022 04:17:52 +0300 Subject: Catch more status codes in Wolfram commands (#1136) --- bot/exts/utilities/wolfram.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'bot/exts/utilities/wolfram.py') diff --git a/bot/exts/utilities/wolfram.py b/bot/exts/utilities/wolfram.py index 984431f0..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 -- cgit v1.2.3