diff options
Diffstat (limited to 'src/handlers')
| -rw-r--r-- | src/handlers/playCommand.js | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/handlers/playCommand.js b/src/handlers/playCommand.js index c61e009..81c498f 100644 --- a/src/handlers/playCommand.js +++ b/src/handlers/playCommand.js @@ -136,12 +136,19 @@ async function createVoiceConnection(voiceChannel, interaction) { selfDeaf: true, }); + const stateLogger = (oldState, newState) => { + console.log(`[VOICE STATE] Guild: ${guildId}, ${oldState.status} -> ${newState.status}${newState.reason ? ` (reason: ${newState.reason})` : ''}${newState.closeCode ? ` (closeCode: ${newState.closeCode})` : ''}`); + }; + connection.on('stateChange', stateLogger); + try { await entersState(connection, VoiceConnectionStatus.Ready, 30000); + connection.off('stateChange', stateLogger); return connection; } catch (error) { lastError = error; - console.error(`Failed to join voice channel (attempt ${attempt}/${maxAttempts}):`, error); + console.error(`Failed to join voice channel (attempt ${attempt}/${maxAttempts}), last state: ${connection.state?.status}:`, error); + connection.off('stateChange', stateLogger); try { connection.destroy(); } catch (e) { |
