From 09ed5e67a6dc5ceb79f7023b0dde3afbd2203de9 Mon Sep 17 00:00:00 2001 From: Tobotimus Date: Thu, 23 Nov 2017 17:21:53 +1100 Subject: [PATCH] Handle inability do delete others' messages (#1111) --- redbot/core/context.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/redbot/core/context.py b/redbot/core/context.py index 0e69168c4..a092f647f 100644 --- a/redbot/core/context.py +++ b/redbot/core/context.py @@ -109,5 +109,10 @@ class RedContext(commands.Context): await query.delete() break else: - await self.channel.delete_messages((query, resp)) + try: + await self.channel.delete_messages((query, resp)) + except discord.HTTPException: + # In case the bot can't delete other users' messages, + # or is not a bot account + await query.delete() return ret