diff options
| author | 2020-03-08 19:15:17 +0100 | |
|---|---|---|
| committer | 2020-03-08 19:15:17 +0100 | |
| commit | 4254053af6980c75a845ddcc7f1701f7b86a42a9 (patch) | |
| tree | 27d20d1d22d7c490a290568bb33d1b2e6b30d878 | |
| parent | Add logging to loop start and loop end. (diff) | |
Restrict cog to moderators.
| -rw-r--r-- | bot/cogs/moderation/silence.py | 8 |
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) |