Notifications: guild.channels.fetch() statt .cache für vollständige Channel-Liste

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Daniel 2026-03-08 20:12:51 +01:00
parent 1bcfef68fe
commit 59e7f11162

View file

@ -197,8 +197,10 @@ const notificationsPlugin: Plugin = {
for (const guild of ctx.client.guilds.cache.values()) { for (const guild of ctx.client.guilds.cache.values()) {
// Filter by allowed guilds if configured // Filter by allowed guilds if configured
if (ctx.allowedGuildIds.length > 0 && !ctx.allowedGuildIds.includes(guild.id)) continue; if (ctx.allowedGuildIds.length > 0 && !ctx.allowedGuildIds.includes(guild.id)) continue;
for (const channel of guild.channels.cache.values()) { try {
if (channel.type === ChannelType.GuildText) { const channels = await guild.channels.fetch();
for (const channel of channels.values()) {
if (channel && channel.type === ChannelType.GuildText) {
result.push({ result.push({
channelId: channel.id, channelId: channel.id,
channelName: channel.name, channelName: channel.name,
@ -207,6 +209,9 @@ const notificationsPlugin: Plugin = {
}); });
} }
} }
} catch (err) {
console.error(`${NB} Failed to fetch channels for guild ${guild.name}:`, err);
}
} }
res.json({ channels: result }); res.json({ channels: result });
}); });