首页 > 解决方案 > 更改嵌入颜色的正确方法(discord.js)

问题描述

我想知道他们是否是一种编辑之前已经发送的嵌入颜色的方法。我想在用户对某个表情符号做出反应后更新颜色?

经过一些调试,我发现从messageReaction.message.embeds

[
  MessageEmbed {
    type: 'rich',
    title: null,
    description: 'Its the description thats showing this, kinda cool inst it?',
    url: null,
    color: 9807270,
    timestamp: 1607934639684,
    fields: [],
    thumbnail: {
      url: 'https://cdn.discordapp.com/avatars/501923384448385025/2a50751b22710319060b3b3af8e4952b.webp',
      proxyURL: 'https://images-ext-1.discordapp.net/external/cKWwFnPdQCHFZ_o3x4-g17bDb4Yi8JfKiNkkd7qiXao/https/cdn.discordapp.com/avatars/501923384448385025/2a50751b22710319060b3b3af8e4952b.webp',
      height: 128,
      width: 128
    },
    image: null,
    video: null,
    author: null,
    provider: null,
    footer: {
      text: 'I am a nice little footer that is for testing because test.',
      iconURL: undefined,
      proxyIconURL: undefined
    },
    files: []
  }
]

但是当我使用console.log(messageReaction.message.embeds.description)它时返回undefined..

因此,使用该功能编辑消息.edit将不起作用,因为该嵌入中的描述、时间戳、页脚、缩略图等已经将丢失..

标签: javascriptdiscord.js

解决方案


找到了问题,因为它返回了一个我需要使用的数组messageReaction.message.embeds[0].description


推荐阅读