refactor(GuildMember): throw better errors on #kickable and #bannable (#7137)

This commit is contained in:
Rodry
2022-01-09 12:18:50 +00:00
committed by GitHub
parent ab3ff5a262
commit 4fd127e79e

View File

@@ -243,6 +243,7 @@ class GuildMember extends Base {
* @readonly
*/
get kickable() {
if (!this.guild.me) throw new Error('GUILD_UNCACHED_ME');
return this.manageable && this.guild.me.permissions.has(Permissions.FLAGS.KICK_MEMBERS);
}
@@ -252,6 +253,7 @@ class GuildMember extends Base {
* @readonly
*/
get bannable() {
if (!this.guild.me) throw new Error('GUILD_UNCACHED_ME');
return this.manageable && this.guild.me.permissions.has(Permissions.FLAGS.BAN_MEMBERS);
}