mirror of
https://github.com/danbulant/discord.js
synced 2026-06-04 15:21:22 +00:00
Fix permission checking for Administrator channel overwrites (#2756)
This commit is contained in:
parent
3f81b613d8
commit
d437cecb3f
3 changed files with 9 additions and 9 deletions
|
|
@ -290,7 +290,7 @@ class GuildChannel extends Channel {
|
||||||
get members() {
|
get members() {
|
||||||
const members = new Collection();
|
const members = new Collection();
|
||||||
for (const member of this.guild.members.values()) {
|
for (const member of this.guild.members.values()) {
|
||||||
if (this.permissionsFor(member).has('VIEW_CHANNEL')) {
|
if (this.permissionsFor(member).has('VIEW_CHANNEL', false)) {
|
||||||
members.set(member.id, member);
|
members.set(member.id, member);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -537,7 +537,7 @@ class GuildChannel extends Channel {
|
||||||
* @readonly
|
* @readonly
|
||||||
*/
|
*/
|
||||||
get deletable() {
|
get deletable() {
|
||||||
return this.permissionsFor(this.client.user).has(Permissions.FLAGS.MANAGE_CHANNELS);
|
return this.permissionsFor(this.client.user).has(Permissions.FLAGS.MANAGE_CHANNELS, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -549,7 +549,7 @@ class GuildChannel extends Channel {
|
||||||
if (this.client.user.id === this.guild.ownerID) return true;
|
if (this.client.user.id === this.guild.ownerID) return true;
|
||||||
const permissions = this.permissionsFor(this.client.user);
|
const permissions = this.permissionsFor(this.client.user);
|
||||||
if (!permissions) return false;
|
if (!permissions) return false;
|
||||||
return permissions.has([Permissions.FLAGS.MANAGE_CHANNELS, Permissions.FLAGS.VIEW_CHANNEL]);
|
return permissions.has([Permissions.FLAGS.MANAGE_CHANNELS, Permissions.FLAGS.VIEW_CHANNEL], false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -335,7 +335,7 @@ class Message extends Base {
|
||||||
*/
|
*/
|
||||||
get deletable() {
|
get deletable() {
|
||||||
return !this.deleted && (this.author.id === this.client.user.id || (this.guild &&
|
return !this.deleted && (this.author.id === this.client.user.id || (this.guild &&
|
||||||
this.channel.permissionsFor(this.client.user).has(Permissions.FLAGS.MANAGE_MESSAGES)
|
this.channel.permissionsFor(this.client.user).has(Permissions.FLAGS.MANAGE_MESSAGES, false)
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -346,7 +346,7 @@ class Message extends Base {
|
||||||
*/
|
*/
|
||||||
get pinnable() {
|
get pinnable() {
|
||||||
return !this.guild ||
|
return !this.guild ||
|
||||||
this.channel.permissionsFor(this.client.user).has(Permissions.FLAGS.MANAGE_MESSAGES);
|
this.channel.permissionsFor(this.client.user).has(Permissions.FLAGS.MANAGE_MESSAGES, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ class VoiceChannel extends GuildChannel {
|
||||||
* @readonly
|
* @readonly
|
||||||
*/
|
*/
|
||||||
get deletable() {
|
get deletable() {
|
||||||
return super.deletable && this.permissionsFor(this.client.user).has(Permissions.FLAGS.CONNECT);
|
return super.deletable && this.permissionsFor(this.client.user).has(Permissions.FLAGS.CONNECT, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -75,8 +75,8 @@ class VoiceChannel extends GuildChannel {
|
||||||
*/
|
*/
|
||||||
get joinable() {
|
get joinable() {
|
||||||
if (browser) return false;
|
if (browser) return false;
|
||||||
if (!this.permissionsFor(this.client.user).has('CONNECT')) return false;
|
if (!this.permissionsFor(this.client.user).has('CONNECT', false)) return false;
|
||||||
if (this.full && !this.permissionsFor(this.client.user).has('MOVE_MEMBERS')) return false;
|
if (this.full && !this.permissionsFor(this.client.user).has('MOVE_MEMBERS', false)) return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -86,7 +86,7 @@ class VoiceChannel extends GuildChannel {
|
||||||
* @readonly
|
* @readonly
|
||||||
*/
|
*/
|
||||||
get speakable() {
|
get speakable() {
|
||||||
return this.permissionsFor(this.client.user).has('SPEAK');
|
return this.permissionsFor(this.client.user).has('SPEAK', false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue