mirror of
https://github.com/danbulant/discord.js
synced 2026-07-14 23:50:40 +00:00
feat(GuildChannel): add manageable getter (#2439)
* Adds GuildChannel.manageable * Resolve requested changes * fix eslint max-len error * Fix for nullable permissionsFor() * Indent fixes
This commit is contained in:
parent
a5e8f05d01
commit
ef4bd92c8a
1 changed files with 11 additions and 0 deletions
|
|
@ -539,6 +539,17 @@ class GuildChannel extends Channel {
|
||||||
return this.permissionsFor(this.client.user).has(Permissions.FLAGS.MANAGE_CHANNELS);
|
return this.permissionsFor(this.client.user).has(Permissions.FLAGS.MANAGE_CHANNELS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the channel is manageable by the client user
|
||||||
|
* @type {boolean}
|
||||||
|
* @readonly
|
||||||
|
*/
|
||||||
|
get manageable() {
|
||||||
|
if (this.client.user.id === this.guild.ownerID) return true;
|
||||||
|
const permissions = this.permissionsFor(this.client.user);
|
||||||
|
return permissions && permissions.has([Permissions.FLAGS.MANAGE_CHANNELS, Permissions.FLAGS.VIEW_CHANNEL]);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes this channel.
|
* Deletes this channel.
|
||||||
* @param {string} [reason] Reason for deleting this channel
|
* @param {string} [reason] Reason for deleting this channel
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue