Skip to content

Disconnect user from Voice Channel #925

Answered by darichey
TryhardOne asked this question in Q&A
Discussion options

You must be logged in to vote

Hi, you can use GuildMemberEditSpec#setNewVoiceChannel(@Nullable Snowflake). For example, your method would be written as

private void kickUser(Member m) {
  m.edit(spec -> spec.setNewVoiceChannel(null)).block();
}

Your attempt is actually trying to disconnect the bot from the channel. See VoiceChannel#getVoiceConnection(). The exception is probably because the bot is not in the channel.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@TryhardOne
Comment options

Answer selected by TryhardOne
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants