utility.guildinfo: hopefully fix permissions check for hidden channels
This commit is contained in:
parent
cfdc862535
commit
43fac0f1de
1 changed files with 10 additions and 6 deletions
|
@ -1786,7 +1786,6 @@ guildinfo.callback = async function (msg, line) {
|
|||
switch (_guild.source) {
|
||||
case "local": {
|
||||
const roles = Array.from(guild.roles.values());
|
||||
const defaultRole = roles.find((role) => role.name == "@everyone");
|
||||
|
||||
const channelTypeCounts = {};
|
||||
let nsfwChannels = 0;
|
||||
|
@ -1798,14 +1797,19 @@ guildinfo.callback = async function (msg, line) {
|
|||
|
||||
if (channel.nsfw) nsfwChannels++;
|
||||
|
||||
const defaultPermissions = channel.permissionOverwrites.get(
|
||||
defaultRole.id
|
||||
);
|
||||
let defaultPermissions = channel.permissionOverwrites.get(guild.id);
|
||||
if (!defaultPermissions && channel.parentID) {
|
||||
defaultPermissions = guild.channels
|
||||
.get(channel.parentID)
|
||||
.permissionOverwrites.get(guild.id);
|
||||
}
|
||||
if (
|
||||
defaultPermissions &&
|
||||
(channel instanceof VoiceChannel
|
||||
? !defaultPermissions.has(Constants.Permissions.voiceConnect)
|
||||
: !defaultPermissions.has(Constants.Permissions.viewChannel))
|
||||
? (defaultPermissions.deny & Constants.Permissions.voiceConnect) ===
|
||||
Constants.Permissions.voiceConnect
|
||||
: (defaultPermissions.deny & Constants.Permissions.viewChannel) ===
|
||||
Constants.Permissions.viewChannel)
|
||||
) {
|
||||
hiddenChannels++;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue