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,15 +197,20 @@ 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();
result.push({ for (const channel of channels.values()) {
channelId: channel.id, if (channel && channel.type === ChannelType.GuildText) {
channelName: channel.name, result.push({
guildId: guild.id, channelId: channel.id,
guildName: guild.name, 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 }); res.json({ channels: result });