Disconnect user from Voice Channel #925
-
Hello, I was trying to add a function to my bot, so that if a user is self deaf in a channel for a certain time, my bot will kick him. What I tried was:
However, doing this results in an NullPointerException: reactor.core.publisher.Mono.block() is null |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi, you can use 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 |
Beta Was this translation helpful? Give feedback.
Hi, you can use
GuildMemberEditSpec#setNewVoiceChannel(@Nullable Snowflake)
. For example, your method would be written asYour 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.