aboutsummaryrefslogtreecommitdiffstats
path: root/bot/exts/holidays
diff options
context:
space:
mode:
authorGravatar shtlrs <[email protected]>2023-05-06 14:06:53 +0100
committerGravatar shtlrs <[email protected]>2023-05-06 14:06:53 +0100
commitcd16be11b5686f4d8e63db303b884ed88efb18d1 (patch)
treef4fbc6bc4cd93ba2a89b1c4cc6c5c2012549421e /bot/exts/holidays
parentuse the new code jam variable (#1267) (diff)
Run null check on needed api keys before loading cogs.
This makes sure that all cogs that need keys won't load. Which helps in avoiding exceptions at runtime, and give a clearer warning at startup time.
Diffstat (limited to 'bot/exts/holidays')
-rw-r--r--bot/exts/holidays/halloween/scarymovie.py3
-rw-r--r--bot/exts/holidays/halloween/spookygif.py3
2 files changed, 6 insertions, 0 deletions
diff --git a/bot/exts/holidays/halloween/scarymovie.py b/bot/exts/holidays/halloween/scarymovie.py
index 00c96153..fbab3dd2 100644
--- a/bot/exts/holidays/halloween/scarymovie.py
+++ b/bot/exts/holidays/halloween/scarymovie.py
@@ -135,4 +135,7 @@ class ScaryMovie(commands.Cog):
async def setup(bot: Bot) -> None:
"""Load the Scary Movie Cog."""
+ if not Tokens.tmdb:
+ log.warning("No TMDB Token. Not loading ScaryMovie Cog.")
+ return
await bot.add_cog(ScaryMovie(bot))
diff --git a/bot/exts/holidays/halloween/spookygif.py b/bot/exts/holidays/halloween/spookygif.py
index 7a90a8a9..41488678 100644
--- a/bot/exts/holidays/halloween/spookygif.py
+++ b/bot/exts/holidays/halloween/spookygif.py
@@ -35,4 +35,7 @@ class SpookyGif(commands.Cog):
async def setup(bot: Bot) -> None:
"""Spooky GIF Cog load."""
+ if not Tokens.giphy:
+ log.warning("No Giphy token. Not loading Giphy cog.")
+ return
await bot.add_cog(SpookyGif(bot))