message on reaction add event v14.3.0
client.rest.on(Events.MessageReactionAdd, async (reaction, user) => {Hello, is anyone knows how i can get the reaction that are added from a specific message in 14.3.0 ?
client.rest.on(Events.MessageReactionAdd, async (reaction, user) => {.rest; just client.on(...) is correct for almost every eventreaction.message.id to the id of the specific messagereaction.emoji is the emoji that was addedend event whose first parameter is a Collection of each reaction added since the collector was createdcollector.on() when i react to A, but when i react to B, i still enter to my collector.on(){
BaseClient: [class BaseClient extends EventEmitter],
Client: [class Client extends BaseClient],
Shard: [class Shard extends EventEmitter],
ShardClientUtil: [class ShardClientUtil],
ShardingManager: [class ShardingManager extends EventEmitter],
WebhookClient: [class WebhookClient extends BaseClient],`
....restclient.on(...)reaction.message.idreaction.emoji client.rest.on(Events.MessageReactionAdd, async (reaction, user) => {
^
TypeError: Cannot read properties of undefined (reading 'on')const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildVoiceStates,
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildMessageReactions
],
partials: [Partials.Message, Partials.Channel, Partials.Reaction],
});client.on('messageCreate', message => {
...
command.execute(message, args, Discord, client);
...
});const { Client, GatewayIntentBits, Partials } = require('discord.js');collector.on()collector.on() const filterReactionCollector = (reaction, user) => {
return [emojiA, emojiB, emojiC, emojiD].includes(reaction._emoji.id)
&& usersReaction[user] == undefined
&& reaction.message.channel.id == channel;
};
const collector = theMessage.createReactionCollector({ filterReactionCollector, time: time1 * 1000 });
collector.on('collect', (reaction, user) => {
console.log([emojiA, emojiB, emojiC, emojiD].includes(reaction._emoji.id)
&& usersReaction[user] == undefined
&& reaction.message.channel.id == channel);const { Client, Events, GatewayIntentBits, Partials } = require('discord.js');
const client = new Client({
intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.GuildMessageReactions],
partials: [Partials.Message, Partials.Channel, Partials.Reaction],
});
client.on(Events.MessageReactionAdd, async (reaction, user) => {
// When a reaction is received, check if the structure is partial
if (reaction.partial) {
// If the message this reaction belongs to was removed, the fetching might result in an API error which should be handled
try {
await reaction.fetch();
} catch (error) {
console.error('Something went wrong when fetching the message:', error);
// Return as `reaction.message.author` may be undefined/null
return;
}
}
// Now the message has been cached and is fully available
console.log(`${reaction.message.author}'s message "${reaction.message.content}" gained a reaction!`);
// The reaction is now also fully available and the properties will be reflected accurately:
console.log(`${reaction.count} user(s) have given the same reaction to this message!`);
});