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) {
|
switch (_guild.source) {
|
||||||
case "local": {
|
case "local": {
|
||||||
const roles = Array.from(guild.roles.values());
|
const roles = Array.from(guild.roles.values());
|
||||||
const defaultRole = roles.find((role) => role.name == "@everyone");
|
|
||||||
|
|
||||||
const channelTypeCounts = {};
|
const channelTypeCounts = {};
|
||||||
let nsfwChannels = 0;
|
let nsfwChannels = 0;
|
||||||
|
@ -1798,14 +1797,19 @@ guildinfo.callback = async function (msg, line) {
|
||||||
|
|
||||||
if (channel.nsfw) nsfwChannels++;
|
if (channel.nsfw) nsfwChannels++;
|
||||||
|
|
||||||
const defaultPermissions = channel.permissionOverwrites.get(
|
let defaultPermissions = channel.permissionOverwrites.get(guild.id);
|
||||||
defaultRole.id
|
if (!defaultPermissions && channel.parentID) {
|
||||||
);
|
defaultPermissions = guild.channels
|
||||||
|
.get(channel.parentID)
|
||||||
|
.permissionOverwrites.get(guild.id);
|
||||||
|
}
|
||||||
if (
|
if (
|
||||||
defaultPermissions &&
|
defaultPermissions &&
|
||||||
(channel instanceof VoiceChannel
|
(channel instanceof VoiceChannel
|
||||||
? !defaultPermissions.has(Constants.Permissions.voiceConnect)
|
? (defaultPermissions.deny & Constants.Permissions.voiceConnect) ===
|
||||||
: !defaultPermissions.has(Constants.Permissions.viewChannel))
|
Constants.Permissions.voiceConnect
|
||||||
|
: (defaultPermissions.deny & Constants.Permissions.viewChannel) ===
|
||||||
|
Constants.Permissions.viewChannel)
|
||||||
) {
|
) {
|
||||||
hiddenChannels++;
|
hiddenChannels++;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue