feat(Emoji): add deletable getter

Backport for commit: fca6d3be56
From PR: #2535
This commit is contained in:
SpaceEEC
2018-05-08 11:35:14 +02:00
parent 21326f67a0
commit ed8ab91782

View File

@@ -1,5 +1,6 @@
const Constants = require('../util/Constants');
const Collection = require('../util/Collection');
const Permissions = require('../util/Permissions');
const Snowflake = require('../util/Snowflake');
/**
@@ -76,6 +77,15 @@ class Emoji {
return new Date(this.createdTimestamp);
}
/**
* Whether the moej is deletable by the client user
* @type {boolean}
* @readonly
*/
get deletable() {
return !this.managed && this.guild.me.hasPermission(Permissions.FLAGS.MANAGE_EMOJIS);
}
/**
* A collection of roles this emoji is active for (empty if all), mapped by role ID
* @type {Collection<Snowflake, Role>}