【发布时间】:2023-03-14 06:26:01
【问题描述】:
如您所见,这是一个带有 2 个选项的建议命令,但是当我输入 .sug 时,机器人会发送嵌入内容,这很好,但随后他会立即发送 A 表情符号的消息,然后立即发送“您的建议我什至没有做任何事情。也没有错误。我认为机器人在某种程度上将他自己对自己的消息的反应作为用户的反应,然后他认为由于他自己的反应(可能)而发送的“请为...建议一些东西”是来自的建议消息用户,所以他发送“您的建议已被填充到材料团队”这是一个屏幕截图的链接:https://ibb.co/KwMBmtc
execute(message, client, args) {
const Discord = require('discord.js');
let Embed = new Discord.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(function (message) {
message.react("????")
message.react("????")
const filter = (reaction, user) => {
return ['????', '????'].includes(reaction.emoji.name) && user.id;
};
message.awaitReactions(filter, { max: 1 })
.then(collected => {
const reaction = collected.first();
if (reaction.emoji.name === '????') {
const filter = m => m.author.id === message.author.id;
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) => {
if (collected.first().content.toLowerCase() === 'cancel') {
message.reply("Your suggestion has been cancelled.")
}
else {
let embed1 = new Discord.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")
channel.send({embed: embed1, files: [{
attachment:'CloudX.png',
name:'CloudX.png'
}]})
message.channel.send(`Your suggestion has been filled to the staff team. Thank you!`)
}
})
}
if (reaction.emoji.name === '????') {
const filter = m => m.author.id === message.author.id;
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) => {
if (collected.first().content.toLowerCase() === 'cancel') {
message.reply("Your suggestion has been cancelled.")
}
else {
let embed2 = new Discord.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")
channel.send({embed: embed2, files: [{
attachment:'CloudX.png',
name:'CloudX.png'
}]})
message.channel.send(`Your suggestion has been filled to the staff team. Thank you!`)
}
})
}
})
})
},
【问题讨论】:
标签: javascript async-await bots discord.js message