From 593e5fe3172ac36de1f4875ce1eb734734a15d70 Mon Sep 17 00:00:00 2001 From: Shivansh-007 Date: Sun, 18 Apr 2021 06:53:07 +0530 Subject: On msg edits, edit the msg link embed rather than deleting it --- bot/exts/moderation/incidents.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/bot/exts/moderation/incidents.py b/bot/exts/moderation/incidents.py index a2548daca..f6607e651 100644 --- a/bot/exts/moderation/incidents.py +++ b/bot/exts/moderation/incidents.py @@ -528,10 +528,15 @@ class Incidents(Cog): The edited message is also passed into `add_signals` if it is a incident message. """ - if is_incident(msg_before): - if msg_before.id in self.message_link_embeds_cache.items: - # Deletes the message link embed found in cache from the channel and cache. - await self.delete_msg_link_embed(msg_before) + + webhook_embed_list = await extract_message_links(msg_after, self.bot) + webhook_msg_id = self.message_link_embeds_cache.get(msg_before.id) + + if webhook_msg_id: + await self.incidents_webhook.edit_message( + message_id=webhook_msg_id, + embeds=[x for x in webhook_embed_list if x is not None], + ) if is_incident(msg_after): webhook_embed_list = await extract_message_links(msg_after, self.bot) -- cgit v1.2.3