From 53d0990ebec1c0712983ed0711e2e08765424ffb Mon Sep 17 00:00:00 2001 From: NoLogicAlan Date: Tue, 27 Oct 2026 00:18:13 +0300 Subject: [PATCH] fix(core): reset textChannel reference on announcement permission errors - Unset player.textChannel when encountering MISSING_PERMISSIONS (403) - Prevents player from repeatedly attempting to announce in blocked channels --- src/core/BotVoiceMixin.mjs | 1 + src/music/PlayerLifecycleMixin.mjs | 1 + 2 files changed, 2 insertions(+) diff --git a/src/core/BotVoiceMixin.mjs b/src/core/BotVoiceMixin.mjs index aeb4ed7..d246563 100644 --- a/src/core/BotVoiceMixin.mjs +++ b/src/core/BotVoiceMixin.mjs @@ -383,6 +383,7 @@ const BotVoiceMixin = { : { embeds: [new EmbedBuilder().setColor(getGlobalColor()).setDescription(m)], allowedMentions: { parse: [] } }; ch.send(payload).catch(err => { if (err.code === 'MISSING_PERMISSIONS' || err.statusCode === 403) { + player.textChannel = null; logger.warn(`[_spawnPlayer] Cannot send announcement in channel ${ch.id} — missing permissions`); } else { logger.warn(`[_spawnPlayer] Failed to send announcement in channel ${ch.id}:`, err?.message ?? err); diff --git a/src/music/PlayerLifecycleMixin.mjs b/src/music/PlayerLifecycleMixin.mjs index 39239c9..1e3934e 100644 --- a/src/music/PlayerLifecycleMixin.mjs +++ b/src/music/PlayerLifecycleMixin.mjs @@ -567,6 +567,7 @@ const PlayerLifecycleMixin = { ch = asSendable(ch); ch.send(payload).catch(err => { if (err.code === 'MISSING_PERMISSIONS' || err.statusCode === 403) { + player.textChannel = null; logger.warn(`[PlayerManager] Cannot send player message in channel ${ch.id} — missing permissions`); } else { logger.warn(`[PlayerManager] Failed to send player message in channel ${ch.id}:`, err?.message ?? err);