所以最近我尝试在我的Discord机器人中实现命令处理程序。所有具有Rich Embeds的命令都出现错误“无法读取未定义的属性'发送'。发送帮助
代码:
const Discord = require('discord.js');
const ms = require('ms');
const bot = new Discord.Client();
var botname = 'Dev Bot'
var version = '1.0.0'
var author = 'potato#9347'
module.exports = {
name: "suggest",
description: "Sends suggestions to a suggestions channel",
execute(message, args)
{
var suggestion = args.join(" ").slice(8)
if(!args[1]) return message.reply("You didn't suggest anything")
const suggestionchannel = "685991785138356458"
const suggestembed = new Discord.RichEmbed()
.setTitle('New Suggestion')
.setColor(0x7289DA)
.setFooter('Powered by ' + botname + ' ' + version)
.setTimestamp()
.addField('Suggestion', suggestion)
.addField('Suggested by:', message.author)
bot.channels.get(suggestionchannel).send(suggestembed).then(sentEmbed =>{
sentEmbed.react('?')
sentEmbed.react('?')
message.reply("Thank you for the suggestion")
setTimeout(() => {
message.channel.bulkdelete(2)
}, 1000);
}
)}
}
错误:TypeError:无法读取未定义的属性“发送”