【问题标题】:Accessing Properties of MessageEmbed访问 MessageEmbed 的属性
【发布时间】:2019-04-08 07:57:27
【问题描述】:

我想访问此消息嵌入的描述,但它只会让我去console.log(reaction.message.embeds),然后给我阻止你见下文

如果我尝试输入:console.log(reaction.message.embeds.MessageEmbed.description)
我的控制台显示:TypeError: Cannot read property 'description' of undefined

我假设这是因为我调用不正确,但我不知道任何其他方式来调用该属性...

任何帮助将不胜感激,感谢您阅读...

[ MessageEmbed {
message: 
 Message {
   channel: [TextChannel],
   deleted: false,
   id: '508770239903825922',
   type: 'DEFAULT',
   content: '',
   author: [ClientUser],
   member: [GuildMember],
   pinned: false,
   tts: false,
   nonce: null,
   system: false,
   embeds: [Circular],
   attachments: Collection {},
   createdTimestamp: 1541370677687,
   editedTimestamp: null,
   reactions: [Collection],
   mentions: [MessageMentions],
   webhookID: null,
   hit: null,
   _edits: [Array] },
type: 'rich',
title: 'Canny Valley ????',
description: 'User: <@239449569677672448>',
url: undefined,
color: 3447003,
fields: [],
timestamp: undefined,
thumbnail: null,
image: null,
video: null,
author: null,
provider: null,
footer: null } ]

【问题讨论】:

    标签: javascript node.js discord.js


    【解决方案1】:

    我找到了解决方案,只是想在这里发布,以防将来有人和我有同样的问题......

    Read contents of an embed message from a discord server

    这对我帮助很大,不过我花了很多时间搜索!

    解决方案是:reaction.message.embeds[0].description 给我我需要的确切值!

    【讨论】:

      猜你喜欢
      • 2021-01-18
      • 2021-08-07
      • 2021-04-18
      • 2019-07-05
      • 1970-01-01
      • 2020-12-19
      • 2015-11-03
      • 2020-09-22
      • 2017-02-12
      相关资源
      最近更新 更多