【发布时间】:2019-04-11 08:47:03
【问题描述】:
我在控制台上不断收到错误消息,提示 RichEmbed 字段可能不为空。当我为每个字段定义值时......这是代码:
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 });
}
这是错误:
(node:616) UnhandledPromiseRejectionWarning: RangeError: RichEmbed field values may not be empty.
at RichEmbed.addField
我将不胜感激!提前谢谢!
【问题讨论】:
标签: javascript node.js discord.js