Skip to content

Commit c234338

Browse files
add forbidden error
1 parent d30e807 commit c234338

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

bot/decorators.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -174,12 +174,15 @@ async def inner(self: Cog, ctx: Context, *args, **kwargs) -> None:
174174

175175
await ctx.send(msg)
176176

177-
# Send a DM to the user about the redirect and paste removal
178-
await ctx.author.send(
179-
f"Your command output was redirected to <#{Channels.bot_commands}>."
180-
f" [Click here](<{paste_response.removal}>) to delete the pasted"
181-
" copy of your original command."
182-
)
177+
try:
178+
# Send a DM to the user about the redirect and paste removal
179+
await ctx.author.send(
180+
f"Your command output was redirected to <#{Channels.bot_commands}>."
181+
f" [Click here](<{paste_response.removal}>) to delete the pasted"
182+
" copy of your original command."
183+
)
184+
except discord.Forbidden:
185+
log.warning("Redirect output: Failed to send DM to user. Forbidden.")
183186

184187
scheduling.create_task(func(self, ctx, *args, **kwargs))
185188

0 commit comments

Comments
 (0)