[Core] Catch errors about blocked DMs in [p]traceback (#4329)

This commit is contained in:
Flame442 2020-09-20 13:42:28 -04:00 committed by GitHub
parent ddc5660f2c
commit 47d9069108
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1139,7 +1139,14 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
if self.bot._last_exception: if self.bot._last_exception:
for page in pagify(self.bot._last_exception, shorten_by=10): for page in pagify(self.bot._last_exception, shorten_by=10):
try:
await destination.send(box(page, lang="py")) 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: else:
await ctx.send(_("No exception has occurred yet.")) await ctx.send(_("No exception has occurred yet."))