From ed6562233b888e2789072399ee8becc6a325eba4 Mon Sep 17 00:00:00 2001 From: git-bruh Date: Mon, 14 Dec 2020 15:57:08 +0530 Subject: [PATCH] Handle exception if edited message is deleted on Discord --- main.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 57d425d..dfc572f 100644 --- a/main.py +++ b/main.py @@ -288,7 +288,14 @@ class Callbacks(object): content_dict["m.new_content"]["body"], channel_id ) webhook_message = message_store[edited_event] - await webhook_message.edit(content=edited_content) + + try: + await webhook_message.edit(content=edited_content) + except discord.errors.NotFound as e: + matrix_logger.warning( + f"Failed to edit message {edited_event}: {e}" + ) + return except KeyError: pass