From 47d90691086f1cce3917cf735ef6c5310a184ea5 Mon Sep 17 00:00:00 2001 From: Flame442 <34169552+Flame442@users.noreply.github.com> Date: Sun, 20 Sep 2020 13:42:28 -0400 Subject: [PATCH] [Core] Catch errors about blocked DMs in `[p]traceback` (#4329) --- redbot/core/core_commands.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/redbot/core/core_commands.py b/redbot/core/core_commands.py index cc090ec9b..c3bb97778 100644 --- a/redbot/core/core_commands.py +++ b/redbot/core/core_commands.py @@ -1139,7 +1139,14 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic): if self.bot._last_exception: for page in pagify(self.bot._last_exception, shorten_by=10): - await destination.send(box(page, lang="py")) + try: + await destination.send(box(page, lang="py")) + except discord.HTTPException: + await ctx.channel.send( + "I couldn't send the traceback message to you in DM. " + "Either you blocked me or you disabled DMs in this server." + ) + return else: await ctx.send(_("No exception has occurred yet."))