aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar MarkKoz <[email protected]>2020-03-22 15:03:34 -0700
committerGravatar MarkKoz <[email protected]>2020-03-22 15:54:45 -0700
commitece898460abc2937e9b73d53d2f1f695069ef2e1 (patch)
tree38998a64d7854d7bead4566c688bfbdfbfd75cb7
parentHelpChannels: mention the helper notifications in cog docstring (diff)
Constants: add a config value to toggle help channels extension
-rw-r--r--bot/__main__.py13
-rw-r--r--bot/constants.py1
-rw-r--r--config-default.yml2
3 files changed, 10 insertions, 6 deletions
diff --git a/bot/__main__.py b/bot/__main__.py
index 30a7dee41..f6ca5a9c8 100644
--- a/bot/__main__.py
+++ b/bot/__main__.py
@@ -5,9 +5,8 @@ import sentry_sdk
from discord.ext.commands import when_mentioned_or
from sentry_sdk.integrations.logging import LoggingIntegration
-from bot import patches
+from bot import constants, patches
from bot.bot import Bot
-from bot.constants import Bot as BotConfig
sentry_logging = LoggingIntegration(
level=logging.DEBUG,
@@ -15,12 +14,12 @@ sentry_logging = LoggingIntegration(
)
sentry_sdk.init(
- dsn=BotConfig.sentry_dsn,
+ dsn=constants.Bot.sentry_dsn,
integrations=[sentry_logging]
)
bot = Bot(
- command_prefix=when_mentioned_or(BotConfig.prefix),
+ command_prefix=when_mentioned_or(constants.Bot.prefix),
activity=discord.Game(name="Commands: !help"),
case_insensitive=True,
max_messages=10_000,
@@ -49,7 +48,6 @@ bot.load_extension("bot.cogs.alias")
bot.load_extension("bot.cogs.defcon")
bot.load_extension("bot.cogs.eval")
bot.load_extension("bot.cogs.duck_pond")
-bot.load_extension("bot.cogs.help_channels")
bot.load_extension("bot.cogs.information")
bot.load_extension("bot.cogs.jams")
bot.load_extension("bot.cogs.moderation")
@@ -65,8 +63,11 @@ bot.load_extension("bot.cogs.utils")
bot.load_extension("bot.cogs.watchchannels")
bot.load_extension("bot.cogs.wolfram")
+if constants.HelpChannels.enable:
+ bot.load_extension("bot.cogs.help_channels")
+
# Apply `message_edited_at` patch if discord.py did not yet release a bug fix.
if not hasattr(discord.message.Message, '_handle_edited_timestamp'):
patches.message_edited_at.apply_patch()
-bot.run(BotConfig.token)
+bot.run(constants.Bot.token)
diff --git a/bot/constants.py b/bot/constants.py
index 8e9d40e8d..da1a62780 100644
--- a/bot/constants.py
+++ b/bot/constants.py
@@ -529,6 +529,7 @@ class Free(metaclass=YAMLGetter):
class HelpChannels(metaclass=YAMLGetter):
section = 'help_channels'
+ enable: bool
claim_minutes: int
cmd_whitelist: List[int]
idle_minutes: int
diff --git a/config-default.yml b/config-default.yml
index d87ceade7..12f69deca 100644
--- a/config-default.yml
+++ b/config-default.yml
@@ -505,6 +505,8 @@ mention:
reset_delay: 5
help_channels:
+ enable: false
+
# Minimum interval before allowing a certain user to claim a new help channel
claim_minutes: 15