fix: don't abort radio on voice timeout, continue loading stream like music bot

This commit is contained in:
loki5512344 2026-07-13 00:20:45 +02:00
parent 328845aa75
commit 41bc1358fb
Signed by: boba
GPG key ID: 253067914055423B

View file

@ -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;