【问题标题】:RichEmbed builder not adding fieldRichEmbed 构建器未添加字段
【发布时间】:2026-01-15 16:30:01
【问题描述】:

基本上,正如标题所说,字段没有被添加到我的嵌入中。这是我的代码:

const embed = new Discord.RichEmbed()
  .setTitle('Help')
  .setDescription('Available Commands')
  .setAuthor(client.user.username, client.user.avatarURL)
  .setColor('#3fa8ff')
// .setTimestamp()

console.log(categories);

for (var i = 0; i < categories.length; i++) {
  var tempDesc = '';
  for (var c in commands) {
    if (categories[i] === commands[c].category) {
      tempDesc += `${commands[c]} - ${commands[c].description} - ${commands[c].usage}\n`;
    }
  }
  embed.addField(categories[i], tempDesc);
}

message.channel.send({
  embed
});

我试图注释掉 .setTimestamp() 之类的东西,但没有任何效果。我做错了什么?

【问题讨论】:

    标签: node.js discord.js


    【解决方案1】:

    想通了,我太笨了,把列表和数组搞混了。

    【讨论】: