From 0a43608bbb0900ed8038f1416ff40e1bb09430ad Mon Sep 17 00:00:00 2001 From: Trent Kable Date: Wed, 28 Oct 2020 15:18:06 -0500 Subject: [PATCH] [ChatChart]error handling on embed edit (#179) handles an exception that occurs when bot cannot edit the embed originally sent at invoke that shows the message counter. --- chatchart/chatchart.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/chatchart/chatchart.py b/chatchart/chatchart.py index d484c23..dd2d3df 100644 --- a/chatchart/chatchart.py +++ b/chatchart/chatchart.py @@ -128,7 +128,12 @@ class Chatchart(commands.Cog): description=f"This might take a while...\n{history_counter}/{messages} messages gathered", colour=await self.bot.get_embed_colour(location=channel), ) - await em.edit(embed=new_embed) + await channel.trigger_typing() + try: + await em.edit(embed=new_embed) + except discord.NotFound: + pass # for cases where the embed was deleted preventing the edit + except discord.errors.Forbidden: try: await em.delete()