From 1ba359bdd118ddab59b66fd5095395d629f23be0 Mon Sep 17 00:00:00 2001 From: nova Date: Mon, 13 Jan 2025 11:45:12 +0000 Subject: [PATCH] Fix recursive reactions --- src/extensions/action_items.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/extensions/action_items.py b/src/extensions/action_items.py index 5f5dda8..2779fda 100644 --- a/src/extensions/action_items.py +++ b/src/extensions/action_items.py @@ -160,9 +160,10 @@ async def action_item_reaction(event: hikari.GuildReactionAddEvent) -> None: is_mentioned_user = event.user_id in mentioned_ids has_mentioned_role = any(role_id in mentioned_ids for role_id in member.role_ids) - if is_mentioned_user or has_mentioned_role: + # cross out the action item, if it was not crossed out already + if (is_mentioned_user or has_mentioned_role) and not message.content.startswith("- ✅ ~~"): # add strikethrough and checkmark - updated_content = f"- ✅ ~~{message.content[1:]}~~" + updated_content = f"- ✅ ~~{message.content[2:]}~~" await action_items.client.rest.edit_message( event.channel_id, event.message_id, content=updated_content )