Так что мой бот должен ждать реакции пользователя, а затем он должен отправить сообщение, иногда он ждет (я думаю, из-за соединения inte rnet), но в основном не так, как вы можете видеть на этом скриншоте: https://ibb.co/9gmfcr8 в чем проблема, но даже если я что-то предложу, он не отправляет сообщение на указанный c канал, вместо этого я получаю сообщение об ошибке: RangeError [EMBED_FIELD_VALUE]: MessageEmbed field values may not be empty.
/ UnhandledPromiseRejectionWarning: RangeError [EMBED_FIELD_VALUE]: MessageEmbed field values may not be empty.
Ясно, почему он не ждет реакции или почему он не отправит предложение. Буду благодарен за любой совет / решение.
module.exports = {
name: 'suggest',
aliases: ['sug', 'suggestion'],
description: 'Suggest something for the Bot',
async execute(message, client, args) {
try {
const { MessageEmbed } = require('discord.js');
const Embed = new MessageEmbed()
.setColor('0x0099ff')
.setDescription(`Suggestion categories`)
.addField(`For what you want to suggest something?`, `\nA: I want to suggest something for the Website/Servers/Discord Server\nB: I want to suggest something for the CloudX Bot \n\nPlease react to this message with A or B`)
message.channel.send(Embed).then(async function (message) {
await message.react("?")
await message.react("?")
const filter = (reaction, user) => {
return ['?', '?'].includes(reaction.emoji.name) && user.id;
}
await message.awaitReactions(filter, { max: 1 })
.then(async collected => {
const reaction = collected.first();
if (reaction.emoji.name === '?') {
const filter = m => m.author.id === message.author.id;
await message.channel.send(`Please provide a suggestion for the Website/Servers/Discord Server or cancel this command with "cancel"!`)
message.channel.awaitMessages(filter, { max: 1, })
.then(async (collected) => {
try{
if (collected.first().content.toLowerCase() === 'cancel') {
message.reply("Your suggestion has been cancelled.")
}
else {
const embed1 = new MessageEmbed()
.setColor('0x0099ff')
.setAuthor(message.author.tag)
.addField(`New Suggestion:`, `${collected.first().content}`)
.setFooter(client.user.username, "attachment://CloudX.png")
.setTimestamp();
const channel = await client.channels.fetch("705781201469964308")
await channel.send({embed: embed1, files: [{
attachment:'CloudX.png',
name:'CloudX.png'
}]})
await message.channel.send(`Your suggestion has been filled to the staff team. Thank you!`)
}
} catch (error) {
console.log(error)
}
})
}
if (reaction.emoji.name === '?') {
const filter = m => m.author.id === message.author.id;
await message.channel.send(`Please provide a suggestion for the CloudX Bot or cancel this command with "cancel"!`)
message.channel.awaitMessages(filter, { max: 1, })
.then(async (collected) => {
try{
if (collected.first().content.toLowerCase() === 'cancel') {
message.reply("Your suggestion has been cancelled.")
}
else {
const embed2 = new MessageEmbed()
.setColor('0x0099ff')
.setAuthor(message.author.tag)
.addField(`New Suggestion:`, `${collected.first().content}`)
.setFooter(client.user.username, "attachment://CloudX.png")
.setTimestamp();
const channel = await client.channels.fetch("702825446248808519")
await channel.send({embed: embed2, files: [{
attachment:'CloudX.png',
name:'CloudX.png'
}]})
await message.channel.send(`Your suggestion has been filled to the staff team. Thank you!`)
}
} catch (error) {
console.log(error)
}
})
}
})
})
} catch (error) {
console.log(error)
}
},
catch(err) {
console.log(err)
}
};