From ed8ab9178271346fd76a6390a996578725f9bf9c Mon Sep 17 00:00:00 2001 From: SpaceEEC Date: Tue, 8 May 2018 11:35:14 +0200 Subject: [PATCH] feat(Emoji): add deletable getter Backport for commit: fca6d3be568fa57fb75bb3483ac6d637d5a4e190 From PR: #2535 --- src/structures/Emoji.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/structures/Emoji.js b/src/structures/Emoji.js index 1a86aac1b..d91734bf4 100644 --- a/src/structures/Emoji.js +++ b/src/structures/Emoji.js @@ -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}