mirror of
https://github.com/danbulant/discord.js
synced 2026-06-20 07:02:00 +00:00
fix(GuildEmoji): added a check for managed emojis in fetchAuthor (#2645)
This commit is contained in:
parent
c46cbbfd84
commit
f963621ef1
2 changed files with 5 additions and 0 deletions
|
|
@ -94,6 +94,7 @@ const Messages = {
|
|||
WEBHOOK_MESSAGE: 'The message was not sent by a webhook.',
|
||||
|
||||
EMOJI_TYPE: 'Emoji must be a string or GuildEmoji/ReactionEmoji',
|
||||
EMOJI_MANAGED: 'Emoji is managed and has no Author.',
|
||||
|
||||
REACTION_RESOLVE_USER: 'Couldn\'t resolve the user ID to remove from the reaction.',
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
const GuildEmojiRoleStore = require('../stores/GuildEmojiRoleStore');
|
||||
const Permissions = require('../util/Permissions');
|
||||
const { Error } = require('../errors');
|
||||
const Snowflake = require('../util/Snowflake');
|
||||
const Emoji = require('./Emoji');
|
||||
|
||||
|
|
@ -87,6 +88,9 @@ class GuildEmoji extends Emoji {
|
|||
* @returns {Promise<User>}
|
||||
*/
|
||||
fetchAuthor() {
|
||||
if (this.managed) {
|
||||
return Promise.reject(new Error('EMOJI_MANAGED'));
|
||||
}
|
||||
return this.client.api.guilds(this.guild.id).emojis(this.id).get()
|
||||
.then(emoji => this.client.users.add(emoji.user));
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue