From 45a17e7ebd8f4a92a5acd4ded36f10d89fe0cb55 Mon Sep 17 00:00:00 2001 From: SpaceEEC Date: Tue, 12 Feb 2019 10:16:23 +0100 Subject: [PATCH] fix(Emoji): reject explicit error when MANAGE_EMOJI permissions are missing (#3063) --- src/structures/Emoji.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/structures/Emoji.js b/src/structures/Emoji.js index 09cfff35c..ef332fe68 100644 --- a/src/structures/Emoji.js +++ b/src/structures/Emoji.js @@ -162,6 +162,11 @@ class Emoji { */ fetchAuthor() { if (this.managed) return Promise.reject(new Error('Emoji is managed and has no Author.')); + if (!this.guild.me.permissions.has(Permissions.FLAGS.MANAGE_EMOJIS)) { + return Promise.reject( + new Error(`Client must have Manage Emoji permission in guild ${this.guild} to see emoji authors.`) + ); + } return this.client.rest.makeRequest('get', Constants.Endpoints.Guild(this.guild).Emoji(this.id), true) .then(emoji => this.client.dataManager.newUser(emoji.user)); }