From 41bc1358fb78bc67af8a8b38b16415ceec40f080 Mon Sep 17 00:00:00 2001 From: loki5512344 Date: Mon, 13 Jul 2026 00:20:45 +0200 Subject: [PATCH] fix: don't abort radio on voice timeout, continue loading stream like music bot --- .../loki/feature/radio/RadioManager.java | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/main/java/creator/loki/feature/radio/RadioManager.java b/src/main/java/creator/loki/feature/radio/RadioManager.java index 1236227..6ea72c5 100644 --- a/src/main/java/creator/loki/feature/radio/RadioManager.java +++ b/src/main/java/creator/loki/feature/radio/RadioManager.java @@ -100,21 +100,26 @@ public class RadioManager { if (!guild.getAudioManager().isConnected()) { guild.getAudioManager().openAudioConnection(vc); } - if (!VoiceHelper.waitForCondition( - () -> self.getVoiceState().inAudioChannel(), VOICE_TIMEOUT_MS, TimeUnit.MILLISECONDS)) { + // Ждём голосовой статус (не прерываемся если не дождались — дальше создаём плеер) + var inChannel = VoiceHelper.waitForCondition( + () -> self.getVoiceState().inAudioChannel(), VOICE_TIMEOUT_MS, TimeUnit.MILLISECONDS); + if (!inChannel) { logger.warn( - "Radio: voice connection timeout for guild {} (channel: {})", + "Radio: voice connection timeout for guild {} (channel: {}), continuing...", guildId, self.getVoiceState().getChannel() != null ? self.getVoiceState().getChannel().getId() : "null"); - return; } var link = lavalinkManager.getOrCreateLink(guildId); - if (!VoiceHelper.waitForCondition( - () -> link.getCachedPlayer() != null, VOICE_TIMEOUT_MS, TimeUnit.MILLISECONDS)) { + var playerReady = VoiceHelper.waitForCondition( + () -> link.getCachedPlayer() != null, VOICE_TIMEOUT_MS, TimeUnit.MILLISECONDS); + if (!playerReady) { LoggerDecorator.warn(logger, "Radio: Lavalink player timeout for guild " + guildId); - return; + } + if (!inChannel || !playerReady) { + LoggerDecorator.warn( + logger, "Radio: problems connecting, but trying to load stream for guild " + guildId); } var mm = new GuildMusicManager(guildId, lavalinkManager, queueRepository); int vol = finalState.volume;