aboutsummaryrefslogtreecommitdiffstats
path: root/bot/utils/decorators.py
diff options
context:
space:
mode:
authorGravatar Chris <[email protected]>2021-03-20 11:13:46 +0000
committerGravatar Chris <[email protected]>2021-03-20 11:13:46 +0000
commit9e01d6b85dd27d8ecb5f00a5cf20f332d534e584 (patch)
treedf4b167c1611edd7d87b9bcc1d91b0e2442743b2 /bot/utils/decorators.py
parentMerge pull request #631 from python-discord/dependabot/pip/pillow-8.1.1 (diff)
Only output override channels & bot commands channel on whitelist error
Previously this would output all channels, and could result in an error. This change ensures only the main bot channel & and any overridden channels are shown in the embed. We do this before the categories block as the categories kwarg itself is an override, so we want to include those in any output.
Diffstat (limited to 'bot/utils/decorators.py')
-rw-r--r--bot/utils/decorators.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/bot/utils/decorators.py b/bot/utils/decorators.py
index c12a15ff..f0e2ff99 100644
--- a/bot/utils/decorators.py
+++ b/bot/utils/decorators.py
@@ -11,7 +11,7 @@ from discord import Colour, Embed
from discord.ext import commands
from discord.ext.commands import CheckFailure, Command, Context
-from bot.constants import ERROR_REPLIES, Month
+from bot.constants import Channels, ERROR_REPLIES, Month, WHITELISTED_CHANNELS
from bot.utils import human_months, resolve_current_month
from bot.utils.checks import in_whitelist_check
@@ -253,6 +253,12 @@ def whitelist_check(**default_kwargs: t.Container[int]) -> t.Callable[[Context],
channels = set(kwargs.get("channels") or {})
categories = kwargs.get("categories")
+ # Only output override channels + community_bot_commands
+ if channels:
+ default_whitelist_channels = set(WHITELISTED_CHANNELS)
+ default_whitelist_channels.discard(Channels.community_bot_commands)
+ channels.difference_update(default_whitelist_channels)
+
# Add all whitelisted category channels
if categories:
for category_id in categories: