From c351e27fdd423420cc59fb4e10abaf0f617b2736 Mon Sep 17 00:00:00 2001 From: kenobi Date: Tue, 27 Jun 2023 20:23:36 +0200 Subject: [PATCH] perform vote message check in reaction handler --- server/events/handleMessageReactionAdd.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/server/events/handleMessageReactionAdd.ts b/server/events/handleMessageReactionAdd.ts index 48a8883..f624e40 100644 --- a/server/events/handleMessageReactionAdd.ts +++ b/server/events/handleMessageReactionAdd.ts @@ -3,6 +3,7 @@ import { Message, MessageReaction, User } from "discord.js"; import { logger, newRequestId, noGuildId } from "../logger"; import { NONE_OF_THAT } from "../constants"; import { client } from "../.."; +import { messageIsVoteMessage } from "../helper/messageIdentifiers"; export const name = 'messageReactionAdd' @@ -25,8 +26,11 @@ export async function execute(messageReaction: MessageReaction, user: User) { logger.info(`emoji: ${messageReaction.emoji.toString()}`) if (messageReaction.emoji.toString() === NONE_OF_THAT) { - logger.info(`Reaction is NONE_OF_THAT. Handling`, { requestId, guildId }) - return client.VoteController.handleNoneOfThatVote(messageReaction, user, reactedUponMessage, requestId, guildId) + if (messageIsVoteMessage(reactedUponMessage)) { + logger.info(`Reaction is NONE_OF_THAT on a vote message. Handling`, { requestId, guildId }) + return client.VoteController.handleNoneOfThatVote(messageReaction, user, reactedUponMessage, requestId, guildId) + + } } return