首页 > 解决方案 > 为什么服务器表情符号 .author 为空?不和谐的js

问题描述

在任何服务器表情符号上,我选择 .author 属性为空,为什么?

在此处输入图像描述 在此处输入图像描述

{
  "animated": false,
  "name": "d53589c38c2a8b20f24976899b0edf0a",
  "id": "899427561174622239",
  "deleted": false,
  "guildID": "843112700561326111",
  "requireColons": null,
  "managed": false,
  "available": true,
  "requiresColons": true,
  "author": null,
  "createdTimestamp": 1634510641140,
  "url": "https://cdn.discordapp.com/emojis/899427561174622239.png",
  "identifier": "d53589c38c2a8b20f24976899b0edf0a:899427561174622239"
}

标签: javascriptdiscord

解决方案


https://github.com/discordjs/discord.js/blob/stable/src/structures/Emoji.js#L25

代码中唯一提到的作者是

class Emoji extends Base {
  constructor(client, emoji) {
    super(client, data, guild);

    /**
     * The user who created this emoji
     * @type {?User}
     */
    this.author = null;

    ...

   _patch(data) {
      super._patch(data);

      if (data.user) this.author = this.client.users._add(data.user);
      if (data.roles) this._roles = data.roles;
    }

   }
}

推荐阅读