Javascript 我的代码怎么了?我不知道';不要出错;我没有得到任何回应
我不明白我的代码有什么问题 用法: /暗示 bot将建议发送到名为sugestions的通道 以下是meh代码:Javascript 我的代码怎么了?我不知道';不要出错;我没有得到任何回应,javascript,node.js,discord.js,Javascript,Node.js,Discord.js,我不明白我的代码有什么问题 用法: /暗示 bot将建议发送到名为sugestions的通道 以下是meh代码: if(cmd === `${prefix}suggest`){ // USAGE: // /suggest this is the suggestion let suggestion = args.join(" ").slice(22); let suggestEmbed = new Discord.RichEmbed() .setDescription(
if(cmd === `${prefix}suggest`){
// USAGE:
// /suggest this is the suggestion
let suggestion = args.join(" ").slice(22);
let suggestEmbed = new Discord.RichEmbed()
.setDescription("~~-------~~**__NEW SUGGESTION!__**~~-------~~")
.setColor("#ff0000")
.addField("Suggestion By", `${message.author} (${message.author.id})`)
.addField("Channel", message.channel)
.addField("Time", message.createdAt)
.addField("Suggestion", suggestion)
.setTimestamp()
.setFooter("Use /invite to invite me to your server!");
let suggestchannel = message.guild.channels.find(`name`, "suggestions");
if(!suggestchannel) return message.channel.send("Couldn't find suggestions channel. Please **create one for this command to work!**");
message.delete().catch(O_o=>{});
suggestchannel.send(suggestEmbed);
return;
}
您的代码行
suggestchannel.send(…)
出错。无法将嵌入作为消息内容发送,因为该必须是字符串。
在这里,您可以找到有关这方面的更多信息:
这是正确的代码,请尝试使用以下代码:
if (cmd === `${prefix}suggest`) {
// USAGE:
// /suggest this is the suggestion
const suggestion = args.join(' ').slice(22);
const suggestEmbed = new Discord.RichEmbed()
.setDescription('~~-------~~**__NEW SUGGESTION!__**~~-------~~')
.setColor('#ff0000')
.addField('Suggestion By', `${message.author} (${message.author.id})`)
.addField('Channel', message.channel)
.addField('Time', message.createdAt)
.addField('Suggestion', suggestion)
.setTimestamp()
.setFooter('Use /invite to invite me to your server!');
const suggestchannel = message.guild.channels.find(`name`, 'suggestions');
if (!suggestchannel) return message.channel.send("Couldn't find suggestions channel. Please **create one for this command to work!**");
message.delete().catch(O_o => {});
suggestchannel.send({ embed: suggestEmbed });
}