diff options
| -rw-r--r-- | bot/decorators.py | 9 | ||||
| -rw-r--r-- | bot/exts/utils/snekbox.py | 3 |
2 files changed, 9 insertions, 3 deletions
diff --git a/bot/decorators.py b/bot/decorators.py index 2d0f8bf0d..f65ec4103 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: @@ -148,7 +151,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: """ |