aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bot/cogs/moderation/silence.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/bot/cogs/moderation/silence.py b/bot/cogs/moderation/silence.py
index 560a0a15c..0081a420e 100644
--- a/bot/cogs/moderation/silence.py
+++ b/bot/cogs/moderation/silence.py
@@ -8,8 +8,9 @@ from discord.ext import commands, tasks
from discord.ext.commands import Context, TextChannelConverter
from bot.bot import Bot
-from bot.constants import Channels, Emojis, Guild, Roles
+from bot.constants import Channels, Emojis, Guild, MODERATION_ROLES, Roles
from bot.converters import HushDurationConverter
+from bot.utils.checks import with_role_check
log = logging.getLogger(__name__)
@@ -147,3 +148,8 @@ class Silence(commands.Cog):
@_notifier.after_loop
async def _log_notifier_end(self) -> None:
log.trace("Stopping notifier loop.")
+
+ # 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, *MODERATION_ROLES)