const Discord = require ("Discord.js")
exports.exec = async (client, message, args) => {
const bug = args.slice().join(" ");
if (!args[0]) return message.channel.send(`${message.author}\` Please right, in as much detail about the bug\``);
const channel = client.channels.get('498750658569306123')
const embed = new Discord.RichEmbed()
.setAuthor(message.author.tag, message.author.avatarURL)
.setColor(0)
.setDescription(bug)
.setTimestamp()
.setFooter(`Suggestion by ${message.author.tag} from ${message.guild.name}`)
channel.send(embed)
返回的错误是:
TypeError: Cannot read property 'send' of undefined
at Object.exports.exec (C:\Users\Cake\Peepo\modules\help\bugreport.js:14:11)
一切似乎都正常。.我不确定如何定义“ send
”?有人在解释吗?
答案 0 :(得分:0)
尝试执行此操作以找到您的报告频道。
let channel = message.guild.channels.find(c => c.name === "report-channel-name-here");
channel.send(embed);
如果失败,请确保您的机器人可以访问该频道。