mirror of
https://github.com/danbulant/discord.js
synced 2026-06-04 15:21:22 +00: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:
parent
90312952d9
commit
fca6d3be56
1 changed files with 12 additions and 0 deletions
|
|
@ -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);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue