From 19820e72095b0d684a788b33230c5b6d6316363e Mon Sep 17 00:00:00 2001 From: NoLogicAlan Date: Tue, 5 May 2026 18:32:51 +0300 Subject: [PATCH] lets see --- src/dashboard/Dashboard.mjs | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/dashboard/Dashboard.mjs b/src/dashboard/Dashboard.mjs index a41a371..ac07aa8 100644 --- a/src/dashboard/Dashboard.mjs +++ b/src/dashboard/Dashboard.mjs @@ -237,14 +237,26 @@ export class Dashboard { * @param {import("discord.js").Guild} guild */ static convertServer(guild) { + // Defensively handle guild.channels — @fluxerjs/core may not always + // populate .cache (e.g. during recovery or for partial guild objects), + // or guild.channels itself may be a Map/Collection without a .cache + // wrapper. Fallback to guild.channels directly if .cache is absent. + const channelStore = guild.channels?.cache ?? guild.channels; + const channelIds = channelStore && typeof channelStore.keys === "function" + ? [...channelStore.keys()] + : []; + const channelValues = channelStore && typeof channelStore.values === "function" + ? [...channelStore.values()] + : []; + return { name: guild.name, id: guild.id, - icon: guild.iconURL() ?? null, - channelIds: [...guild.channels.cache.keys()], + icon: typeof guild.iconURL === "function" ? guild.iconURL() : null, + channelIds, description: guild.description ?? null, ownerId: guild.ownerId, - channels: [...guild.channels.cache.values()].map(Dashboard.convertChannel), + channels: channelValues.map(Dashboard.convertChannel), }; }