javascript - 更改嵌入颜色的正确方法(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
将不起作用,因为该嵌入中的描述、时间戳、页脚、缩略图等已经将丢失..
解决方案
找到了问题,因为它返回了一个我需要使用的数组messageReaction.message.embeds[0].description
。
推荐阅读
- java - 不能跑扑医生--执照
- regex - 用于在 Google Data Studio 中提取年份或月份的 REGEXP_EXTRACT 特定字符串
- ios - 无效的 UINavigationController 颜色 iPhone UISplitViewController
- python - 这个快速排序代码(Python)有什么问题?
- python - sklearn 的 check_estimator 的 check_transformer_data_not_an_array 测试的目的是什么?
- html - 我该如何解决?我的引导模式弹出到屏幕的最右侧而不是在中心?
- python - Python:防止列表中的连续重复
- ios - 如何仅在 swift 中禁用标签栏标签?
- c# - 将数组添加到 POST 参数 C#
- react-native - 如何为应用程序 React Native 添加提醒?