Skip to content

Commit

Permalink
check if a guildchannel is deletable (#1143)
Browse files Browse the repository at this point in the history
* Update GuildChannel.js

* eghhh

* Update GuildChannel.js
  • Loading branch information
devsnek authored and amishshah committed Jan 28, 2017
1 parent c7f5b44 commit 2beb77a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/structures/GuildChannel.js
Expand Up @@ -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}
Expand Down

0 comments on commit 2beb77a

Please sign in to comment.