aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Leon Sandøy <[email protected]>2020-07-13 15:20:59 +0200
committerGravatar Leon Sandøy <[email protected]>2020-07-13 15:20:59 +0200
commit87c2ef7610a42207b0289820458285648f5dd41e (patch)
treefe788ebb19c71b2a405c41aa7c801f4a57a75462
parentAdd avatar_url in python_news.py (diff)
Only mods+ may use the commands in this cog.
https://github.com/python-discord/bot/issues/667
-rw-r--r--bot/cogs/dm_relay.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/bot/cogs/dm_relay.py b/bot/cogs/dm_relay.py
index c6206629e..67411f57b 100644
--- a/bot/cogs/dm_relay.py
+++ b/bot/cogs/dm_relay.py
@@ -8,6 +8,8 @@ from discord.ext.commands import Cog
from bot import constants
from bot.bot import Bot
+from bot.constants import MODERATION_ROLES
+from bot.utils.checks import with_role_check
from bot.utils.messages import send_attachments
from bot.utils.webhooks import send_webhook
@@ -93,6 +95,10 @@ class DMRelay(Cog):
except discord.HTTPException:
log.exception("Failed to send an attachment to the webhook")
+ def cog_check(self, ctx: commands.Context) -> bool:
+ """Only allow moderators to invoke the commands in this cog."""
+ return with_role_check(ctx, *MODERATION_ROLES)
+
def setup(bot: Bot) -> None:
"""Load the DMRelay cog."""