Answer the question
In order to leave comments, you need to log in
The code is not working correctly. How to fix?
Wrote a small code to confirm actions.
client.on('message', message => {
if(message.author === client.user) return;
if(message.channel.name == 'bot_test') {
const exampleEmbed = new Discord.MessageEmbed()
.setColor('#0099ff')
.setTitle('Подтверждение действия')
.setDescription(`Вополняемое действие: **${message.content}**\nПользователь: <@${message.author.id}> `)
.addFields(
{ name: '✅ - Подтвердить', value: 'При нажатии на реакцию действие подтверждается'},
{ name: '❓ - Подробнее', value: 'При нажатии на реакцию вам в личные сообщения будет отправлено сообщение с описанием действия'},
{ name: '❎ - Отменить', value: 'При нажатии на реакцию действие отменяетмя и сообщение бота удаляется'},
{ name: '**У Вас есть ровно 30 секунд на подтверждение**', value: '\u200B'},
)
.setTimestamp()
.setFooter('Ferrera Family Bot', 'https://i.imgur.com/YDVgOgw.png');
message.channel.send(exampleEmbed)
await message.react('✅');
const filter = (reaction, user) => reaction.emoji.name === '✅' && user.id == message.author.id
const collector = message.createReactionCollector(filter, { time: 15000 });
collector.on('collect', r => message.reply(`Сообщение #1`));
collector.on('end', collected => message.reply(`Сообщение #2`));
message.delete();
}
});
Answer the question
In order to leave comments, you need to log in
some code you have is too confusing, why don't you use the one I suggested in the previous question?
why, where , you specify only one parameter, if the bot should collect not only the reaction, but also the user?
why are you using the method , apart from the sent messages? how does the bot know which one to delete? used for such purposescollector.on("collect", r => . . .)
.delete()
.then(message => {
. . .
})
.delete()
, the time after which the message must be deleted is indicated{ timeout: время_в_миллисекундах }
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question