feat: better private channel detection, bot version debugging (#7680)

Signed-off-by: The-Best-Codes <106822363+The-Best-Codes@users.noreply.github.com>
This commit is contained in:
BestCodes
2026-03-05 14:02:52 -06:00
committed by GitHub
parent 8d04f6f40e
commit f903c62ed0
4 changed files with 29 additions and 29 deletions
@@ -1,5 +1,10 @@
import type { Guild, TextChannel } from "discord.js";
import { ChannelType } from "discord.js";
import { ChannelType, PermissionFlagsBits } from "discord.js";
function isPublicChannel(ch: TextChannel, guild: Guild): boolean {
const everyoneOverwrite = ch.permissionOverwrites.cache.get(guild.id);
return !everyoneOverwrite?.deny.has(PermissionFlagsBits.ViewChannel);
}
export async function buildServerContext(guild: Guild): Promise<string> {
try {
@@ -8,7 +13,9 @@ export async function buildServerContext(guild: Guild): Promise<string> {
const textChannels = Array.from(channels.values())
.filter(
(ch): ch is TextChannel =>
ch?.type === ChannelType.GuildText && ch !== null && ch.viewable,
ch?.type === ChannelType.GuildText &&
ch !== null &&
isPublicChannel(ch, guild),
)
.sort((a, b) => (a.position ?? 0) - (b.position ?? 0));