aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar ToxicKidz <[email protected]>2021-05-05 09:43:32 -0400
committerGravatar ToxicKidz <[email protected]>2021-05-05 09:43:32 -0400
commit0fa28ac392c9ae12c3b800a4e9acb32724ddb783 (patch)
tree27fb3f98f1c60b151399f7ade08919008d3ed8ed
parentchore: Redirect output to bot-commands channel for the eval command (diff)
chore: Don't send a message when redirecting eval output which would ping users twice
-rw-r--r--bot/decorators.py9
-rw-r--r--bot/exts/utils/snekbox.py3
2 files changed, 9 insertions, 3 deletions
diff --git a/bot/decorators.py b/bot/decorators.py
index 5d9d74bd7..e4e640748 100644
--- a/bot/decorators.py
+++ b/bot/decorators.py
@@ -111,13 +111,16 @@ def redirect_output(
destination_channel: int,
bypass_roles: t.Optional[t.Container[int]] = None,
channels: t.Optional[t.Container[int]] = None,
- categories: t.Optional[t.Container[int]] = None
+ categories: t.Optional[t.Container[int]] = None,
+ ping_user: bool = True
) -> t.Callable:
"""
Changes the channel in the context of the command to redirect the output to a certain channel.
Redirect is bypassed if the author has a bypass role or if it is in a channel that can bypass redirection.
+ If ping_user is False, it will not send a message in the destination channel.
+
This decorator must go before (below) the `command` decorator.
"""
def wrap(func: types.FunctionType) -> types.FunctionType:
@@ -147,7 +150,9 @@ def redirect_output(
log.trace(f"Redirecting output of {ctx.author}'s command '{ctx.command.name}' to {redirect_channel.name}")
ctx.channel = redirect_channel
- await ctx.channel.send(f"Here's the output of your command, {ctx.author.mention}")
+
+ if ping_user:
+ await ctx.send(f"Here's the output of your command, {ctx.author.mention}")
asyncio.create_task(func(self, ctx, *args, **kwargs))
message = await old_channel.send(
diff --git a/bot/exts/utils/snekbox.py b/bot/exts/utils/snekbox.py
index 4cc7291e8..b1f1ba6a8 100644
--- a/bot/exts/utils/snekbox.py
+++ b/bot/exts/utils/snekbox.py
@@ -284,7 +284,8 @@ class Snekbox(Cog):
destination_channel=Channels.bot_commands,
bypass_roles=EVAL_ROLES,
categories=NO_EVAL_CATEGORIES,
- channels=NO_EVAL_CHANNELS
+ channels=NO_EVAL_CHANNELS,
+ ping_user=False
)
async def eval_command(self, ctx: Context, *, code: str = None) -> None:
"""