fix: add permission check and remove audio manager fallback for radio voice
This commit is contained in:
parent
fa5a6aab8f
commit
ac46327380
1 changed files with 4 additions and 4 deletions
|
|
@ -88,15 +88,15 @@ public class RadioManager {
|
|||
return;
|
||||
}
|
||||
logger.debug("Radio: connecting to channel {}/{} in guild {}", vc.getName(), channelId, guildId);
|
||||
guild.getJDA().getDirectAudioController().connect(vc);
|
||||
if (!guild.getAudioManager().isConnected()) {
|
||||
guild.getAudioManager().openAudioConnection(vc);
|
||||
}
|
||||
var self = guild.getMember(guild.getJDA().getSelfUser());
|
||||
if (self == null) {
|
||||
logger.warn("Radio: self member is null for guild {}", guildId);
|
||||
return;
|
||||
}
|
||||
logger.debug(
|
||||
"Radio: bot has CONNECT permission: {}",
|
||||
self.hasPermission(vc, net.dv8tion.jda.api.Permission.VOICE_CONNECT));
|
||||
guild.getJDA().getDirectAudioController().connect(vc);
|
||||
if (!VoiceHelper.waitForCondition(
|
||||
() -> self.getVoiceState().inAudioChannel(), VOICE_TIMEOUT_MS, TimeUnit.MILLISECONDS)) {
|
||||
logger.warn(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue