M
M
MoneySMile2021-06-02 07:55:30
Node.js
MoneySMile, 2021-06-02 07:55:30

Discord.js menu not working. What to do?

I need the bot to send a message when entering the command and put a reaction on it
. As soon as the one who wrote the command puts the reaction, the bot reads it and sends another message
(if you can write a normal code, otherwise I have been having trouble with this lately)
I really need help and advice
The bot ignores and does not give errors

The code
const { MessageEmbed } = require('discord.js');
module.exports.properities = {
name:["321"]
}
module.exports.run = async (bot,message,member,args) => {
let page0 = new MessageEmbed()
.setTitle('1')
.setTimestamp()
.setAuthor('1страница')
.setColor("RED")
message.channel.send(page0).then(function (message) {
message.react("◀")
message.react("▶")
message.react("❌")
}).catch(function() {
const collector = message.createReactionCollector((reaction, user) =>
reaction.emoji.name === "◀" ||
reaction.emoji.name === "▶" ||
reaction.emoji.name === "❌"
).once("collect", reaction => {
const chosen = reaction.emoji.name;
if(chosen === "◀"){
let embed = new MessageEmbed()
.setTitle('2')
.setTimestamp()
.setAuthor('2страница')
.setColor("RED")
message.channel.send(embed)
}else if(chosen === "▶"){
let embed2 = new MessageEmbed()
.setTitle('3')
.setTimestamp()
.setAuthor('3страница')
.setColor("RED")
message.channel.send(embed2)
}else{
let embed3 = new MessageEmbed()
.setTitle('4')
.setTimestamp()
.setAuthor('4страница')
.setColor("RED")
message.channel.send(embed3)
}
collector.stop();
});
})
}

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrew Dark, 2021-06-03
@MoneySMile

QQ!
I implemented it with this code and everything worked for me:

let embed = new Discord.MessageEmbed()
    .setDescription(`Твой текст`);
    message.channel.send(embed).then(msg => {
msg.react('✔').then( r => {
msg.react('❌')
const Yes = (reaction, user) => reaction.emoji.name === '✔' && user.id === message.author.id;
const No = (reaction, user) => reaction.emoji.name === '❌' && user.id === message.author.id;

const Yes1 = msg.createReactionCollector(Yes, {timer: 1000});
const No1 = msg.createReactionCollector(No, {timer: 1000});

Yes1.on('collect', r => {
    msg.delete(); 
    let embedYes = new Discord.MessageEmbed()
    .setDescription(`Текст если на галочку`);
    return message.channel.send(embedYes);
    })
No1.on('collect', r => {
    msg.delete(); 
    let embedNo = new Discord.MessageEmbed()
    .setDescription(`Текст если на крестик`);
    return message.channel.send(embedNo);
    })
  })
})

M
MoneySMile, 2021-06-03
@MoneySMile

Everything worked!! Thank you very much!!!! There is only one thing, but in my code, when using new Discord.MessageEmbed(), it gives an error. This is solved by deleting Discord and in the end everything looked like this for me let embed = new MessageEmbed()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question