diff --git a/server/src/plugins/notifications/index.ts b/server/src/plugins/notifications/index.ts index c78db4f..98afae8 100644 --- a/server/src/plugins/notifications/index.ts +++ b/server/src/plugins/notifications/index.ts @@ -197,15 +197,20 @@ const notificationsPlugin: Plugin = { for (const guild of ctx.client.guilds.cache.values()) { // Filter by allowed guilds if configured if (ctx.allowedGuildIds.length > 0 && !ctx.allowedGuildIds.includes(guild.id)) continue; - for (const channel of guild.channels.cache.values()) { - if (channel.type === ChannelType.GuildText) { - result.push({ - channelId: channel.id, - channelName: channel.name, - guildId: guild.id, - guildName: guild.name, - }); + try { + const channels = await guild.channels.fetch(); + for (const channel of channels.values()) { + if (channel && channel.type === ChannelType.GuildText) { + result.push({ + channelId: channel.id, + channelName: channel.name, + guildId: guild.id, + guildName: guild.name, + }); + } } + } catch (err) { + console.error(`${NB} Failed to fetch channels for guild ${guild.name}:`, err); } } res.json({ channels: result });