Skip to content

Commit ab5c8d7

Browse files
committed
fix(quoi-feur): prevent bot for re-reacting on edit
1 parent 9bacefb commit ab5c8d7

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/modules/quoiFeur/quoiFeur.helpers.ts

+11
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,17 @@ export const reactOnEndWithQuoiUpdated = async (
6868
newMessage: Message | PartialMessage,
6969
) => {
7070
if (!(newMessage instanceof Message)) return;
71+
72+
// Both E and U are in feur and coubeh, that should be sufficient to detect if the bot has already reacted
73+
const feurCoubeh = new Set<string>([EMOJI.E, EMOJI.U]);
74+
75+
// Check if the old message already has a reaction
76+
const selfReactions = newMessage.reactions.cache.some((reaction) => {
77+
return reaction.me && reaction.emoji.name && feurCoubeh.has(reaction.emoji.name);
78+
});
79+
80+
if (selfReactions) return;
81+
7182
await reactOnEndWithQuoi(newMessage);
7283
};
7384

0 commit comments

Comments
 (0)