diff options
| author | 2020-02-26 00:29:52 +0100 | |
|---|---|---|
| committer | 2020-02-26 00:29:52 +0100 | |
| commit | 6a2a2b5c3da79fe0097c98a04e435e493c73223d (patch) | |
| tree | fa440fc69f56636e4d9eaa994153da7eb2201b60 | |
| parent | Restyle if body to include the error instead of adding the cog. (diff) | |
Check for empty strings alongside None before loading cog.
Docker fetches values from the .env itself and defaults to "" instead of None, needing to do invalid access token requests before unloading itself.
| -rw-r--r-- | bot/cogs/reddit.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/bot/cogs/reddit.py b/bot/cogs/reddit.py index 3278363ba..7cb340145 100644 --- a/bot/cogs/reddit.py +++ b/bot/cogs/reddit.py @@ -290,7 +290,8 @@ class Reddit(Cog): def setup(bot: Bot) -> None: """Load the Reddit cog.""" - if None in (RedditConfig.client_id, RedditConfig.secret): + invalid_values = "", None + if any(value in (RedditConfig.secret, RedditConfig.client_id) for value in invalid_values): log.error("Credentials not provided, cog not loaded.") return bot.add_cog(Reddit(bot)) |