fix: don't abort radio on voice timeout, continue loading stream like music bot
This commit is contained in:
parent
328845aa75
commit
41bc1358fb
1 changed files with 12 additions and 7 deletions
|
|
@ -100,21 +100,26 @@ public class RadioManager {
|
||||||
if (!guild.getAudioManager().isConnected()) {
|
if (!guild.getAudioManager().isConnected()) {
|
||||||
guild.getAudioManager().openAudioConnection(vc);
|
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(
|
logger.warn(
|
||||||
"Radio: voice connection timeout for guild {} (channel: {})",
|
"Radio: voice connection timeout for guild {} (channel: {}), continuing...",
|
||||||
guildId,
|
guildId,
|
||||||
self.getVoiceState().getChannel() != null
|
self.getVoiceState().getChannel() != null
|
||||||
? self.getVoiceState().getChannel().getId()
|
? self.getVoiceState().getChannel().getId()
|
||||||
: "null");
|
: "null");
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
var link = lavalinkManager.getOrCreateLink(guildId);
|
var link = lavalinkManager.getOrCreateLink(guildId);
|
||||||
if (!VoiceHelper.waitForCondition(
|
var playerReady = VoiceHelper.waitForCondition(
|
||||||
() -> link.getCachedPlayer() != null, VOICE_TIMEOUT_MS, TimeUnit.MILLISECONDS)) {
|
() -> link.getCachedPlayer() != null, VOICE_TIMEOUT_MS, TimeUnit.MILLISECONDS);
|
||||||
|
if (!playerReady) {
|
||||||
LoggerDecorator.warn(logger, "Radio: Lavalink player timeout for guild " + guildId);
|
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);
|
var mm = new GuildMusicManager(guildId, lavalinkManager, queueRepository);
|
||||||
int vol = finalState.volume;
|
int vol = finalState.volume;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue