mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-14 02:23:31 +01:00
feat(GuildEmoji): add deletable getter (#2535)
* feat(GuildEmoji#deletable) * Update: Discord API returns 50001 When you try to get or delete a managed emoji from the API, you get a 50001 (Missing Access) error code.
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
const GuildEmojiRoleStore = require('../stores/GuildEmojiRoleStore');
|
const GuildEmojiRoleStore = require('../stores/GuildEmojiRoleStore');
|
||||||
|
const Permissions = require('../util/Permissions');
|
||||||
const Snowflake = require('../util/Snowflake');
|
const Snowflake = require('../util/Snowflake');
|
||||||
const Emoji = require('./Emoji');
|
const Emoji = require('./Emoji');
|
||||||
|
|
||||||
@@ -44,9 +45,20 @@ class GuildEmoji extends Emoji {
|
|||||||
return clone;
|
return clone;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the emoji is deletable by the client user
|
||||||
|
* @type {boolean}
|
||||||
|
* @readonly
|
||||||
|
*/
|
||||||
|
get deletable() {
|
||||||
|
return !this.managed &&
|
||||||
|
this.channel.permissionsFor(this.client.user).has(Permissions.FLAGS.MANAGE_EMOJIS);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A collection of roles this emoji is active for (empty if all), mapped by role ID
|
* A collection of roles this emoji is active for (empty if all), mapped by role ID
|
||||||
* @type {GuildEmojiRoleStore<Snowflake, Role>}
|
* @type {GuildEmojiRoleStore<Snowflake, Role>}
|
||||||
|
* @readonly
|
||||||
*/
|
*/
|
||||||
get roles() {
|
get roles() {
|
||||||
return new GuildEmojiRoleStore(this);
|
return new GuildEmojiRoleStore(this);
|
||||||
|
|||||||
Reference in New Issue
Block a user