diff --git a/commands/guild.go b/commands/guild.go index 48710a2..52df4ea 100644 --- a/commands/guild.go +++ b/commands/guild.go @@ -109,6 +109,9 @@ func GetSortedChannels(guildId string, withCategories bool, withPrivate bool) [] perms := discord.CalcOverwrites(*guild, channel, *selfMember) private := !perms.Has(discord.PermissionViewChannel) + if perms == 0 { + private = false + } if private && !withPrivate { continue } @@ -192,6 +195,9 @@ func GetSortedChannels(guildId string, withCategories bool, withPrivate bool) [] perms := discord.CalcOverwrites(*guild, channel, *selfMember) private := !perms.Has(discord.PermissionViewChannel) + if perms == 0 { + private = false + } if private && !withPrivate { continue } @@ -247,6 +253,10 @@ func ListChannelsCommand() { perms := discord.CalcOverwrites(*guild, channel, *selfMember) private := !perms.Has(discord.PermissionViewChannel) + if perms == 0 { + private = false + } + category := channel.Type == discord.GuildCategory catLen := 0 @@ -272,6 +282,9 @@ func ListChannelsCommand() { perms := discord.CalcOverwrites(*guild, channel, *selfMember) private := !perms.Has(discord.PermissionViewChannel) + if perms == 0 { + private = false + } category := channel.Type == discord.GuildCategory topic := REGEX_EMOTE.ReplaceAllString(channel.Topic, ":$1:") topic = strings.ReplaceAll(topic, "\n", " ") @@ -368,7 +381,11 @@ func ListUsersCommand() { } perms := discord.CalcOverwrites(*guild, *channel, *member) - if !perms.Has(discord.PermissionViewChannel) { + private := !perms.Has(discord.PermissionViewChannel) + if perms == 0 { + private = false + } + if private { continue } diff --git a/commands/send.go b/commands/send.go index 734fda2..0ba88ce 100644 --- a/commands/send.go +++ b/commands/send.go @@ -50,8 +50,12 @@ func SendMode() { } perms := discord.CalcOverwrites(*guild, *channel, *selfMember) + cannotSend := !perms.Has(discord.PermissionSendMessages) + if perms == 0 { + cannotSend = false + } - if !perms.Has(discord.PermissionSendMessages) { + if cannotSend { fmt.Print("\n\r") return }