From 0e9e5ebb48c3669d946b62391793477f3b8f5824 Mon Sep 17 00:00:00 2001 From: MarkKoz Date: Thu, 26 Sep 2019 21:08:31 -0700 Subject: Catch errors of fetch_user when calling in send_private_embed --- bot/cogs/moderation.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bot/cogs/moderation.py b/bot/cogs/moderation.py index ca46ccef2..c1d355a49 100644 --- a/bot/cogs/moderation.py +++ b/bot/cogs/moderation.py @@ -1033,16 +1033,16 @@ class Moderation(Scheduler, Cog): Returns a boolean indicator of DM success. """ - # sometimes `user` is a `discord.Object`, so let's make it a proper user. - user = await self.bot.fetch_user(user.id) - try: + # sometimes `user` is a `discord.Object`, so let's make it a proper user. + user = await self.bot.fetch_user(user.id) + await user.send(embed=embed) return True - except (HTTPException, Forbidden): + except (HTTPException, Forbidden, NotFound): log.debug( f"Infraction-related information could not be sent to user {user} ({user.id}). " - "They've probably just disabled private messages." + "The user either could not be retrieved or probably disabled their DMs." ) return False -- cgit v1.2.3