我尝试为我的不和谐机器人创建删除/修剪/清除命令,但在机器人删除消息后,它没有响应我创建的消息,但此错误出现在日志中:alpha
我也尝试将其放入命令中:UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'send' of undefined
但是他回复的是错误信息而不是成功信息。
这是代码:
.catch(() => message.channel.send(embedERRPRUNE5))
答案 0 :(得分:0)
它显示嵌入错误,因为在您的 .then(message) 代码中,这意味着您将代替 value then is message 但它不重视 message 它是 then 的 value name message
.then(message => message.channel.send(embedPRUNE)).then(d => d.delete({timeout: 15000})) // In quanto tempo questo messaggio verrà eliminato (in ms).
那么你需要改成其他值或者使用()
试试这个代码
if (msg.startsWith(prefix + "prune") || msg.startsWith(prefix + "purge") || msg.startsWith(prefix + "delete")) {
var embedERRPRUNE5 = new Discord.MessageEmbed()
.setColor("#8c00ee")
.setTitle("❌Something went wrong, while deleting messages.")
.setAuthor("Vittorio De Stradis ツ", "https://cdn.discordapp.com/attachments/784128595084705853/790590227277545502/Cowboy_Bepop_1.png")
.setFooter("If you need help, pls contact me!", "https://cdn.discordapp.com/attachments/784128595084705853/790590227277545502/Cowboy_Bepop_1.png")
.setTimestamp();
var embedPRUNE = new Discord.MessageEmbed()
.setColor("#8c00ee")
.setTitle(`✔ Deleted ${args[0]} messages.`)
.setAuthor("Vittorio De Stradis ツ", "https://cdn.discordapp.com/attachments/784128595084705853/790590227277545502/Cowboy_Bepop_1.png")
.setFooter("If you need help, pls contact me!", "https://cdn.discordapp.com/attachments/784128595084705853/790590227277545502/Cowboy_Bepop_1.png")
.setTimestamp();
await message.delete()
await message.channel.bulkDelete(args[0]).then(() => message.channel.send(embedPRUNE)).then(d => d.delete({timeout: 15000})).catch(() => message.channel.send(embedERRPRUNE5))
}