From ef542d8a507c4b1cc54fec2aa86db534804daa1e Mon Sep 17 00:00:00 2001 From: skelmis Date: Mon, 4 Nov 2024 00:04:08 +1300 Subject: [PATCH] fix: suggestions queue resolution failing if message is deleted --- suggestions/core/suggestions_queue.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/suggestions/core/suggestions_queue.py b/suggestions/core/suggestions_queue.py index 594cae7..3fafea0 100644 --- a/suggestions/core/suggestions_queue.py +++ b/suggestions/core/suggestions_queue.py @@ -105,9 +105,13 @@ async def resolve_queued_suggestion( # If sent to channel queue, delete it if not queued_suggestion.is_in_virtual_queue: - chan = await self.state.fetch_channel(queued_suggestion.channel_id) - msg = await chan.fetch_message(queued_suggestion.message_id) - await msg.delete() + try: + chan = await self.state.fetch_channel(queued_suggestion.channel_id) + msg = await chan.fetch_message(queued_suggestion.message_id) + await msg.delete() + except disnake.NotFound: + # Dont fail if message no longer exists + pass # Send the message to the relevant channel if required if was_approved: