aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Xithrius <[email protected]>2021-08-30 11:43:24 -0700
committerGravatar GitHub <[email protected]>2021-08-30 11:43:24 -0700
commit4e335c7be80d72ab98e93a21e6747648727380b6 (patch)
treeba7c0754bd786731f28e653a4a83e8e60f8d4517
parentRemove the json argument from the raw command. (#1792) (diff)
parentMerge branch 'main' into dmrelay-mod-channel (diff)
Merge pull request #1791 from python-discord/dmrelay-mod-channel
Allow dmrelay to only be used in mod channels.
-rw-r--r--bot/exts/moderation/dm_relay.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/bot/exts/moderation/dm_relay.py b/bot/exts/moderation/dm_relay.py
index 1d2206e27..0051db82f 100644
--- a/bot/exts/moderation/dm_relay.py
+++ b/bot/exts/moderation/dm_relay.py
@@ -5,6 +5,7 @@ from discord.ext.commands import Cog, Context, command, has_any_role
from bot.bot import Bot
from bot.constants import Emojis, MODERATION_ROLES
+from bot.utils.channel import is_mod_channel
from bot.utils.services import send_to_paste_service
log = logging.getLogger(__name__)
@@ -63,8 +64,9 @@ class DMRelay(Cog):
await ctx.send(paste_link)
async def cog_check(self, ctx: Context) -> bool:
- """Only allow moderators to invoke the commands in this cog."""
- return await has_any_role(*MODERATION_ROLES).predicate(ctx)
+ """Only allow moderators to invoke the commands in this cog in mod channels."""
+ return (await has_any_role(*MODERATION_ROLES).predicate(ctx)
+ and is_mod_channel(ctx.channel))
def setup(bot: Bot) -> None: