mirror of
https://github.com/danbulant/discord.js
synced 2026-05-25 04:52:22 +00:00
refactor(Emoji): remove Guild#deleteEmoji in favour of Emoji#delete (#1877)
This commit is contained in:
parent
efbde07650
commit
c93c4ad21f
2 changed files with 10 additions and 13 deletions
|
|
@ -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<Emoji>}
|
||||
*/
|
||||
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
|
||||
|
|
|
|||
|
|
@ -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<Emoji>}
|
||||
*/
|
||||
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<Guild>}
|
||||
|
|
|
|||
Loading…
Reference in a new issue