diff --git a/src/utils/channel-utils.ts b/src/utils/channel-utils.ts index 9f01bf3..7aa4019 100644 --- a/src/utils/channel-utils.ts +++ b/src/utils/channel-utils.ts @@ -2,9 +2,11 @@ import { Channel, GuildBasedChannel, GuildChannel, GuildTextBasedChannel, TextBa import { Database } from '../shared/Database'; export async function channelIsInStaffCategory(channel: GuildBasedChannel) { - if (!channel.guildId) return false; + if (!channel.guildId || !channel.parentId) return false; const staffCategories = await Database.getGuildStaffCategories(channel.guildId); - return staffCategories.includes(channel.parentId!); + const parentChannel = await channel.guild.channels.fetch(channel.parentId); + + return parentChannel?.parentId ? staffCategories.includes(parentChannel.parentId) : staffCategories.includes(channel.parentId); } \ No newline at end of file