Search code examples
discordclientdiscord.py

Is it possible to show by command how many voice channels my Discord bot is currently connected to?


I would like to display via command how many voice channels my bot is currently in, is this possible? Maybe also with extra things like the server ID/channel ID. This is not needed though, just the command and the amount would be good. I already found a method for js but not for Discord.py.


Solution

  • You can use the Bot.voice_clients attribute

    voice_states = bot.voice_clients # or client, however you named your instance
    
    await ctx.send(f'I am currently in {len(voice_states)} voice channels')