Skip to content

How do I check if the bot is in a voice channel? [closed]

How do I check if my discord bot is in a voice channel?
I tried client.member.voice.channel, guild.voice and it all didn’t work!

Answer

The client has a voice property that returns a ClientVoiceManager. voice.connections returns a collection of VoiceConnections, so it has a size property.

It means, you can check if client.voice.connections.size is greater than 0. If it is, the bot is in a voice channel.