From c93c4ad21fc2272ab2269083dd94bbb6af4f7aa7 Mon Sep 17 00:00:00 2001 From: SpaceEEC Date: Sun, 3 Sep 2017 12:01:47 +0200 Subject: [PATCH] refactor(Emoji): remove Guild#deleteEmoji in favour of Emoji#delete (#1877) --- src/structures/Emoji.js | 10 ++++++++++ src/structures/Guild.js | 13 ------------- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/src/structures/Emoji.js b/src/structures/Emoji.js index 2b258c8b4..dcaff2396 100644 --- a/src/structures/Emoji.js +++ b/src/structures/Emoji.js @@ -200,6 +200,16 @@ class Emoji extends Base { return this.requiresColons ? `<:${this.name}:${this.id}>` : this.name; } + /** + * Delete the emoji. + * @param {string} [reason] Reason for deleting the emoji + * @returns {Promise} + */ + delete(reason) { + return this.client.api.guilds(this.guild.id).emojis(this.id).delete({ reason }) + .then(() => this); + } + /** * Whether this emoji is the same as another one. * @param {Emoji|Object} other The emoji to compare it to diff --git a/src/structures/Guild.js b/src/structures/Guild.js index 7895159cc..92627186e 100644 --- a/src/structures/Guild.js +++ b/src/structures/Guild.js @@ -1,6 +1,5 @@ const Long = require('long'); const Role = require('./Role'); -const Emoji = require('./Emoji'); const Invite = require('./Invite'); const GuildAuditLogs = require('./GuildAuditLogs'); const Webhook = require('./Webhook'); @@ -1055,18 +1054,6 @@ class Guild extends Base { .then(image => this.createEmoji(image, name, { roles, reason })); } - /** - * Delete an emoji. - * @param {Emoji|string} emoji The emoji to delete - * @param {string} [reason] Reason for deleting the emoji - * @returns {Promise} - */ - deleteEmoji(emoji, reason) { - if (!(emoji instanceof Emoji)) emoji = this.emojis.get(emoji); - return this.client.api.guilds(this.id).emojis(emoji.id).delete({ reason }) - .then(() => this.client.actions.GuildEmojiDelete.handle(emoji).data); - } - /** * Causes the client to leave the guild. * @returns {Promise}