Search code examples
javadiscord-jda

how can I log out of the jda-discord voice channel


I need the bot itself to exit the discord voice channel, I do not know how to do this, please help.

I tried to kick the bot using the ID, but I couldn't do it.

event.getChannel().asVoiceChannel().getGuild().kick(UserSnowflake.fromId(id));

Solution

  • Since you connected to the channel using guild.getAudioManager().openAudioConnection(channel), the logical opposite is how you leave it with guild.getAudioManager().closeAudioConnection().