aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bot/cogs/moderation/management.py8
-rw-r--r--bot/constants.py5
2 files changed, 11 insertions, 2 deletions
diff --git a/bot/cogs/moderation/management.py b/bot/cogs/moderation/management.py
index 491f6d400..b7f5db2f5 100644
--- a/bot/cogs/moderation/management.py
+++ b/bot/cogs/moderation/management.py
@@ -11,7 +11,7 @@ from bot import constants
from bot.converters import InfractionSearchQuery
from bot.pagination import LinePaginator
from bot.utils import time
-from bot.utils.checks import with_role_check
+from bot.utils.checks import in_channel_check, with_role_check
from . import utils
from .infractions import Infractions
from .modlog import ModLog
@@ -257,7 +257,11 @@ class ModManagement(commands.Cog):
# This cannot be static (must have a __func__ attribute).
def cog_check(self, ctx: Context) -> bool:
"""Only allow moderators to invoke the commands in this cog."""
- return with_role_check(ctx, *constants.MODERATION_ROLES)
+ checks = [
+ with_role_check(ctx, *constants.MODERATION_ROLES),
+ in_channel_check(ctx, *constants.MODERATION_CHANNELS)
+ ]
+ return all(checks)
# This cannot be static (must have a __func__ attribute).
async def cog_command_error(self, ctx: Context, error: Exception) -> None:
diff --git a/bot/constants.py b/bot/constants.py
index f4f45eb2c..f22668a2b 100644
--- a/bot/constants.py
+++ b/bot/constants.py
@@ -347,6 +347,8 @@ class Channels(metaclass=YAMLGetter):
message_log: int
mod_alerts: int
modlog: int
+ mods: int
+ mod_spam: int
off_topic_0: int
off_topic_1: int
off_topic_2: int
@@ -500,6 +502,9 @@ PROJECT_ROOT = os.path.abspath(os.path.join(BOT_DIR, os.pardir))
MODERATION_ROLES = Roles.moderator, Roles.admin, Roles.owner
STAFF_ROLES = Roles.helpers, Roles.moderator, Roles.admin, Roles.owner
+# Default Channel combinations
+MODERATION_CHANNELS = Channels.admins, Channels.mod_alerts, Channels.mods, Channels.mod_spam
+
# Bot replies
NEGATIVE_REPLIES = [