Add poll chat command with reaction voting

This commit is contained in:
Fisto
2026-09-11 15:59:08 +02:00
parent 8e8c15e8bc
commit ace0bb18ff
16 changed files with 291 additions and 9 deletions
+13 -1
View File
@@ -17,8 +17,9 @@ const content = process.env.TEST_TRIGGER_CONTENT ?? "whitelist list";
const guildId = process.env.TEST_TRIGGER_GUILD;
const isGuild = !!guildId;
const mention = isGuild && process.env.TEST_TRIGGER_MENTION !== "0";
const isReaction = process.env.TEST_TRIGGER_REACTION === "1";
const event = {
const messageEvent = {
type: "MESSAGE_CREATE",
id: `30000000000000${Date.now() % 10000}`,
channelId: process.env.TEST_TRIGGER_CHANNEL ?? (isGuild ? "200000000000000010" : "805255536223715370"),
@@ -30,6 +31,17 @@ const event = {
timestamp: new Date().toISOString()
};
const reactionEvent = {
type: process.env.TEST_TRIGGER_REMOVE === "1" ? "MESSAGE_REACTION_REMOVE" : "MESSAGE_REACTION_ADD",
messageId: process.env.TEST_REACTION_MESSAGE_ID ?? "msg-1",
channelId: process.env.TEST_TRIGGER_CHANNEL ?? "200000000000000010",
guildId: guildId ?? "100000000000000001",
userId: authorId,
emoji: { name: process.env.TEST_REACTION_EMOJI ?? "1️⃣", id: null }
};
const event = isReaction ? reactionEvent : messageEvent;
await new Promise<void>((resolve, reject) => {
const socket = net.connect(coreSocketPath);
socket.setEncoding("utf-8");