From 20e5470ed83cf8de9e8ac61e00c2ab132f4778d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Fuch=C3=9F?= Date: Wed, 25 Aug 2021 22:26:57 +0200 Subject: [PATCH] Only one emoji per person in !summon --- user_commands/summon.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/user_commands/summon.py b/user_commands/summon.py index 093ddd4..699b3ef 100644 --- a/user_commands/summon.py +++ b/user_commands/summon.py @@ -313,10 +313,18 @@ async def __update_message(user: User, emoji_id: str, message: Message): all_reactions = await __get_summon_reactions(get_guild(message)) reactions: Dict[str, List[str]] = __read_text_reactions(all_reactions, text) - if user.mention in reactions[emoji_id]: - reactions[emoji_id].remove(user.mention) - else: - reactions[emoji_id].append(user.mention) + for emoji in reactions.keys(): + if emoji != emoji_id and user.mention in reactions[emoji]: + # Remove at any other place + reactions[emoji].remove(user.mention) + + if emoji != emoji_id: + continue + + if user.mention in reactions[emoji_id]: + reactions[emoji_id].remove(user.mention) + else: + reactions[emoji_id].append(user.mention) result_msg = text.split("\n")[0].strip() summary = ""