javascript - 为什么服务器表情符号 .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"
}
解决方案
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;
}
}
}
推荐阅读
- jquery - JSON 不使用 jQuery getJSON 解释
- javascript - 在此上下文中仅允许返回数字或布尔值的变量表达式
- powershell - Powershell仅删除一行的第一个单词
- npm - webpack 4 是否对已经被 webpack 捆绑的 npm 包进行重复数据删除?
- codeigniter - 在注销 Codigniter 时从 ci_sessions 表中删除会话
- sql - 如何恢复 postgres 转储
- c++ - 如何在 C++ 中用字母做简单的数学操作数?
- ruby-on-rails - 用户授权 Rails Admin + Rails API + React JS
- javascript - 添加 if/else 以使用 ajax 更改比较表中的内容
- r - 如何通过考虑 R 中的列组合来创建循环