aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Volcyy <[email protected]>2018-05-08 10:52:06 +0200
committerGravatar Gareth Coles <[email protected]>2018-05-08 09:52:06 +0100
commit01a2b0840f5d1c508ed5632d6e99882c853734af (patch)
treef9ada42876e5fd7111a9b3ebdba33d67b436d279
parentCodeblock 1.0 (#35) (diff)
Don't load ClickUp cog if `CLICKUP_KEY` is unset. (#70)
-rw-r--r--bot/__main__.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/bot/__main__.py b/bot/__main__.py
index ebd91f836..5c1184c10 100644
--- a/bot/__main__.py
+++ b/bot/__main__.py
@@ -1,11 +1,15 @@
+import logging
import os
from aiohttp import AsyncResolver, ClientSession, TCPConnector
from discord import Game
from discord.ext.commands import AutoShardedBot, when_mentioned_or
+from bot.constants import CLICKUP_KEY
from bot.formatter import Formatter
+log = logging.getLogger(__name__)
+
bot = AutoShardedBot(
command_prefix=when_mentioned_or(
"self.", "bot."
@@ -33,7 +37,14 @@ bot.load_extension("bot.cogs.events")
# Commands, etc
bot.load_extension("bot.cogs.bot")
bot.load_extension("bot.cogs.cogs")
-bot.load_extension("bot.cogs.clickup")
+
+# Local setups usually don't have the clickup key set,
+# and loading the cog would simply spam errors in the console.
+if CLICKUP_KEY is not None:
+ bot.load_extension("bot.cogs.clickup")
+else:
+ log.warning("`CLICKUP_KEY` not set in the environment, not loading the ClickUp cog.")
+
bot.load_extension("bot.cogs.deployment")
bot.load_extension("bot.cogs.eval")
bot.load_extension("bot.cogs.fun")