when a message receives a reaction or emoji, I want to save the letter "y" in Wish.
I need to use emoji in client.on("message", (message), not another, the next error is
ReferenceError: emoji is not defined
but i have no idea how to solve it
const { Client, Intents } = require("discord.js-selfbot");
const client = new Client({
intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES, Intents.FLAGS.GUILD_MESSAGE_REACTIONS],
});
let token = "";
client.on('ready', () => {
console.log('Ok!');
});
let ListWish = ["❤","💖","💘"];
let Wish;
client.on("message", (message) => {
if(ListWish.includes(emoji.name)){
Wish = 'y';
}
if(message.embeds.length >= 0)
// Check if the Message has embed or not
{
let embed = message.embeds
for(let i = 0; i < embed.length; i++)
{
if (!embed[i] || !embed[i].description) return;
// check each embed if it has description or not, if it doesnt then do nothing
{
if(Wish === 'y'){
message.channel.send("Have emoji heart")
}
}
}
}
});
client.login(token);
You can use the Message.awaitReactions() method to listen for reactions on a certain message without the need of using client.on('event').
The documentation already contains code that easily summarizes how to use it, so I won't write any code here.
Edit: I almost forgot to add this, I am pretty sure you can pass in a callback after the options, so there is no need to use .then().