check if a guildchannel is deletable (#1143)

* Update GuildChannel.js

* eghhh

* Update GuildChannel.js
This commit is contained in:
Gus Caplan
2017-01-28 04:07:53 -06:00
committed by Amish Shah
parent c7f5b44e03
commit 2beb77ab5c

View File

@@ -281,6 +281,16 @@ class GuildChannel extends Channel {
return equal;
}
/**
* Whether the channel is deletable by the client user.
* @type {boolean}
* @readonly
*/
get deletable() {
return this.id !== this.guild.id &&
this.permissionsFor(this.client.user).hasPermission(Constants.PermissionFlags.MANAGE_CHANNELS);
}
/**
* When concatenated with a string, this automatically returns the channel's mention instead of the Channel object.
* @returns {string}