generated from Baipyrus/DiscordJS-Template
detect users adding/removing reactions
This commit is contained in:
parent
713135a021
commit
0edf46856a
@ -1,6 +1,8 @@
|
||||
import { Events } from 'discord.js';
|
||||
|
||||
export const name = Events.MessageReactionAdd;
|
||||
export async function execute(messageReaction, user) {
|
||||
console.log(messageReaction, user);
|
||||
export async function execute(reaction, user) {
|
||||
const uname = user.username;
|
||||
const rname = reaction._emoji.name;
|
||||
console.debug(`[DEBUG] User '${uname}' reacted with emoji '${rname}'.`);
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
import { Events } from 'discord.js';
|
||||
|
||||
export const name = Events.MessageReactionRemove;
|
||||
export async function execute(messageReaction, user) {
|
||||
console.log(messageReaction, user);
|
||||
export async function execute(reaction, user) {
|
||||
const uname = user.username;
|
||||
const rname = reaction._emoji.name;
|
||||
console.debug(`[DEBUG] User '${uname}' removed reaction of emoji '${rname}'.`);
|
||||
}
|
||||
|
10
index.js
10
index.js
@ -4,6 +4,7 @@ import { fileURLToPath } from 'url';
|
||||
import { promisify } from 'util';
|
||||
import { config } from 'dotenv';
|
||||
import { readdir } from 'fs';
|
||||
import { Partials } from 'discord.js';
|
||||
|
||||
config();
|
||||
const readdirAsync = promisify(readdir);
|
||||
@ -13,7 +14,14 @@ const optional = ['autocomplete', 'modalSubmit'];
|
||||
|
||||
const runClient = (commands, events) => {
|
||||
// Create a new client instance
|
||||
const client = new Client({ intents: [GatewayIntentBits.Guilds] });
|
||||
const client = new Client({
|
||||
intents: [
|
||||
GatewayIntentBits.Guilds,
|
||||
GatewayIntentBits.GuildMessages,
|
||||
GatewayIntentBits.GuildMessageReactions
|
||||
],
|
||||
partials: [Partials.Message, Partials.Reaction]
|
||||
});
|
||||
client.commands = new Collection();
|
||||
commands.forEach((c) => client.commands.set(c.data.name, c));
|
||||
events.forEach((e) =>
|
||||
|
Loading…
Reference in New Issue
Block a user