diff options
| author | 2020-02-24 22:22:11 +0100 | |
|---|---|---|
| committer | 2020-02-24 22:22:11 +0100 | |
| commit | b4ed7107d162d1961ae4dc03cdda282123fbb877 (patch) | |
| tree | 3075ae24ce1d72f63eece2d3374cd2d04471ba7f | |
| parent | Remove unused `chunks` function and its tests. (diff) | |
Do not attempt to load Reddit cog when environment variables are not provided.
When environment variables weren't provided; the cog attempted to create a BasicAuth object with None as values resulting in an exception before the event loop was started and a subsequent crash.
| -rw-r--r-- | bot/cogs/reddit.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/bot/cogs/reddit.py b/bot/cogs/reddit.py index aa487f18e..dce73fcf2 100644 --- a/bot/cogs/reddit.py +++ b/bot/cogs/reddit.py @@ -290,4 +290,7 @@ class Reddit(Cog): def setup(bot: Bot) -> None: """Load the Reddit cog.""" - bot.add_cog(Reddit(bot)) + if None not in (RedditConfig.client_id, RedditConfig.secret): + bot.add_cog(Reddit(bot)) + return + log.error("Credentials not provided, cog not loaded.") |