aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Shivansh-007 <[email protected]>2021-04-18 06:53:07 +0530
committerGravatar Shivansh-007 <[email protected]>2021-10-11 12:05:35 +0530
commit593e5fe3172ac36de1f4875ce1eb734734a15d70 (patch)
tree0306b21e66fad0959f2f87910e2c95306086dfc9
parentMake incidents channel webhook a cog level attribute (diff)
On msg edits, edit the msg link embed rather than deleting it
-rw-r--r--bot/exts/moderation/incidents.py13
1 files 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)