aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bot/cogs/moderation/management.py1
-rw-r--r--bot/decorators.py3
-rw-r--r--bot/utils/checks.py7
3 files changed, 9 insertions, 2 deletions
diff --git a/bot/cogs/moderation/management.py b/bot/cogs/moderation/management.py
index c7c19e89d..c39c7f3bc 100644
--- a/bot/cogs/moderation/management.py
+++ b/bot/cogs/moderation/management.py
@@ -291,6 +291,7 @@ class ModManagement(commands.Cog):
channels=constants.MODERATION_CHANNELS,
categories=[constants.Categories.modmail],
redirect=None,
+ fail_silently=True,
)
]
return all(checks)
diff --git a/bot/decorators.py b/bot/decorators.py
index 1e77afe60..500197c89 100644
--- a/bot/decorators.py
+++ b/bot/decorators.py
@@ -23,6 +23,7 @@ def in_whitelist(
categories: Container[int] = (),
roles: Container[int] = (),
redirect: Optional[int] = Channels.bot_commands,
+ fail_silently: bool = False,
) -> Callable:
"""
Check if a command was issued in a whitelisted context.
@@ -39,7 +40,7 @@ def in_whitelist(
"""
def predicate(ctx: Context) -> bool:
"""Check if command was issued in a whitelisted context."""
- return in_whitelist_check(ctx, channels, categories, roles, redirect)
+ return in_whitelist_check(ctx, channels, categories, roles, redirect, fail_silently)
return commands.check(predicate)
diff --git a/bot/utils/checks.py b/bot/utils/checks.py
index 63568b29e..d5ebe4ec9 100644
--- a/bot/utils/checks.py
+++ b/bot/utils/checks.py
@@ -40,6 +40,7 @@ def in_whitelist_check(
categories: Container[int] = (),
roles: Container[int] = (),
redirect: Optional[int] = constants.Channels.bot_commands,
+ fail_silently: bool = False,
) -> bool:
"""
Check if a command was issued in a whitelisted context.
@@ -81,7 +82,11 @@ def in_whitelist_check(
return True
log.trace(f"{ctx.author} may not use the `{ctx.command.name}` command within this context.")
- raise InWhitelistCheckFailure(redirect)
+
+ # Some commands are secret, and should produce no feedback at all.
+ if not fail_silently:
+ raise InWhitelistCheckFailure(redirect)
+ return False
def with_role_check(ctx: Context, *role_ids: int) -> bool: