perform vote message check in reaction handler
Compile the repository / compile (pull_request) Successful in 1m15s Details
Run unit tests / test (pull_request) Successful in 1m26s Details

This commit is contained in:
kenobi 2023-06-27 20:23:36 +02:00
parent 6d3bea169e
commit c351e27fdd
1 changed files with 6 additions and 2 deletions

View File

@ -3,6 +3,7 @@ import { Message, MessageReaction, User } from "discord.js";
import { logger, newRequestId, noGuildId } from "../logger"; import { logger, newRequestId, noGuildId } from "../logger";
import { NONE_OF_THAT } from "../constants"; import { NONE_OF_THAT } from "../constants";
import { client } from "../.."; import { client } from "../..";
import { messageIsVoteMessage } from "../helper/messageIdentifiers";
export const name = 'messageReactionAdd' export const name = 'messageReactionAdd'
@ -25,8 +26,11 @@ export async function execute(messageReaction: MessageReaction, user: User) {
logger.info(`emoji: ${messageReaction.emoji.toString()}`) logger.info(`emoji: ${messageReaction.emoji.toString()}`)
if (messageReaction.emoji.toString() === NONE_OF_THAT) { if (messageReaction.emoji.toString() === NONE_OF_THAT) {
logger.info(`Reaction is NONE_OF_THAT. Handling`, { 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 client.VoteController.handleNoneOfThatVote(messageReaction, user, reactedUponMessage, requestId, guildId)
}
} }
return return