aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar MarkKoz <[email protected]>2020-10-16 11:39:18 -0700
committerGravatar MarkKoz <[email protected]>2020-11-20 15:53:34 -0800
commited68051a47e67d8e60498a866a8c3c54840aa6fb (patch)
tree58fbe4a3d8ebe4d45af8769574d871a8781ba7eb
parentMerge pull request #1287 from python-discord/help-channel-msg (diff)
Help channels: move to a subpackage
-rw-r--r--bot/exts/help_channels/__init__.py17
-rw-r--r--bot/exts/help_channels/_cog.py (renamed from bot/exts/help_channels.py)10
2 files changed, 17 insertions, 10 deletions
diff --git a/bot/exts/help_channels/__init__.py b/bot/exts/help_channels/__init__.py
new file mode 100644
index 000000000..38444b707
--- /dev/null
+++ b/bot/exts/help_channels/__init__.py
@@ -0,0 +1,17 @@
+import logging
+
+from bot.bot import Bot
+
+log = logging.getLogger(__name__)
+
+
+def setup(bot: Bot) -> None:
+ """Load the HelpChannels cog."""
+ # Defer import to reduce side effects from importing the sync package.
+ from bot.exts.help_channels import _cog
+ try:
+ _cog.validate_config()
+ except ValueError as e:
+ log.error(f"HelpChannels cog will not be loaded due to misconfiguration: {e}")
+ else:
+ bot.add_cog(_cog.HelpChannels(bot))
diff --git a/bot/exts/help_channels.py b/bot/exts/help_channels/_cog.py
index ced2f72ef..5e2a7dd71 100644
--- a/bot/exts/help_channels.py
+++ b/bot/exts/help_channels/_cog.py
@@ -928,13 +928,3 @@ def validate_config() -> None:
f"max_total_channels ({total}) must be less than or equal to "
f"{MAX_CHANNELS_PER_CATEGORY} due to Discord's limit on channels per category."
)
-
-
-def setup(bot: Bot) -> None:
- """Load the HelpChannels cog."""
- try:
- validate_config()
- except ValueError as e:
- log.error(f"HelpChannels cog will not be loaded due to misconfiguration: {e}")
- else:
- bot.add_cog(HelpChannels(bot))