Add poll chat command with reaction voting
This commit is contained in:
+13
-1
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user