From cd58599caf9de08597ad76c473253f68f0d5112f Mon Sep 17 00:00:00 2001 From: Kyra Date: Wed, 29 Aug 2018 08:45:27 +0200 Subject: [PATCH] fix(Guild#deleteEmoji): reject non emojis / emoji IDs (#2793) * fix(Guild#deleteEmoji): Performing wrong checks * fix: requested changes `a string` -> `an id` * fix: requested changes `id` -> `ID` --- src/structures/Guild.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/structures/Guild.js b/src/structures/Guild.js index f98302779..f7c1e8770 100644 --- a/src/structures/Guild.js +++ b/src/structures/Guild.js @@ -1114,7 +1114,8 @@ class Guild { * @returns {Promise} */ deleteEmoji(emoji, reason) { - if (!(emoji instanceof Emoji)) emoji = this.emojis.get(emoji); + if (typeof emoji === 'string') emoji = this.emojis.get(emoji); + if (!(emoji instanceof Emoji)) throw new TypeError('Emoji must be either an instance of Emoji or an ID'); return this.client.rest.methods.deleteEmoji(emoji, reason); }