From e4ae6a98bcb193a676c4a18bc3adfd4c8f4c2a76 Mon Sep 17 00:00:00 2001 From: NoLogicAlan Date: Tue, 12 May 2026 23:31:13 +0300 Subject: [PATCH] fixed --- src/PlayerManager.mjs | 13 +++++++++++++ src/RecoveryManager.mjs | 12 ++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/PlayerManager.mjs b/src/PlayerManager.mjs index 59502e9..78ee356 100644 --- a/src/PlayerManager.mjs +++ b/src/PlayerManager.mjs @@ -508,6 +508,13 @@ export class PlayerManager { ); if (player) { player.textChannel = message.channel; + try { + const guildId = getMessageGuildId(message); + const textChannelId = message?.channel?.id ?? message?.channel?.channel?.id ?? null; + if (guildId && textChannelId) { + this.settings.getServer(guildId)?.set("announcementChannelId", textChannelId); + } + } catch (_) {} return player; } // Also check if a join is in-progress for this channel @@ -542,6 +549,12 @@ export class PlayerManager { ); if (match) { match[1].textChannel = message.channel; + try { + const textChannelId = message?.channel?.id ?? message?.channel?.channel?.id ?? null; + if (cleanGuildId && textChannelId) { + this.settings.getServer(cleanGuildId)?.set("announcementChannelId", textChannelId); + } + } catch (_) {} return match[1]; } diff --git a/src/RecoveryManager.mjs b/src/RecoveryManager.mjs index 2d6ebe3..1ea10d2 100644 --- a/src/RecoveryManager.mjs +++ b/src/RecoveryManager.mjs @@ -351,7 +351,10 @@ export class RecoveryManager { const cachedChId = remix._announcementChannelCache.get(guildId) ?? serverSet.get("announcementChannelId") ?? null; - let ch = cachedChId ? guild?.channels?.get(String(cachedChId)) : null; + let ch = p.textChannel?.channel ?? p.textChannel ?? null; + if (typeof ch?.send !== "function") { + ch = cachedChId ? guild?.channels?.get(String(cachedChId)) : null; + } if (cachedChId && !ch) { remix._announcementChannelCache.delete(guildId); } @@ -367,7 +370,12 @@ export class RecoveryManager { } } } - if (typeof ch?.send === "function") ch.send({ embeds: [{ description: String(m), color: getGlobalColor() }] }).catch(() => {}); + if (typeof ch?.send === "function") { + const payload = (typeof m === "object" && Array.isArray(m?.embeds)) + ? m + : { embeds: [{ description: String(m), color: getGlobalColor() }] }; + ch.send(payload).catch(() => {}); + } }); // ── Join channel ───────────────────────────────────────────────────────