[英]“send” is undefined? | Discord.js
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
”是如何定义的? 有人在解释吗?
尝试执行此操作以找到您的报告频道。
let channel = message.guild.channels.find(c => c.name === "report-channel-name-here");
channel.send(embed);
如果失败,请确保您的机器人可以访问该频道。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.