From b8a32aab409f1f9e0a8a940823997f24a54842e0 Mon Sep 17 00:00:00 2001 From: kenobi Date: Sun, 25 Jun 2023 01:57:40 +0200 Subject: [PATCH] stub for reactionhandling --- server/events/handleReactionAdd.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 server/events/handleReactionAdd.ts diff --git a/server/events/handleReactionAdd.ts b/server/events/handleReactionAdd.ts new file mode 100644 index 0000000..f2fd445 --- /dev/null +++ b/server/events/handleReactionAdd.ts @@ -0,0 +1,20 @@ + +import { Message, MessageReaction, User } from "discord.js"; +import { messageIsVoteMessage } from "../helper/messageIdentifiers"; +import { logger, newRequestId, noGuildId } from "../logger"; + + +export const name = 'messageReactionAdd' + +export async function execute(messageReaction: MessageReaction, user: User) { + const requestId = newRequestId + const guildId = messageReaction.message.inGuild() ? messageReaction.message.guildId : noGuildId + + const reactedUponMessage: Message = messageReaction.message.partial ? await messageReaction.message.fetch() : messageReaction.message + + if (messageIsVoteMessage(reactedUponMessage)) { + logger.info(`Got reaction on message`, { requestId, guildId }) + } + + return +}