mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
fix(GuildEmoji): added a check for managed emojis in fetchAuthor (#2645)
This commit is contained in:
@@ -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));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user