Home > Mobile >  Get id of voice channel where bot is connected to
Get id of voice channel where bot is connected to

Time:05-31

I Want to get the voice channel ID of the voice channel where the bot is connected to. is there any command for it ?

CodePudding user response:

You are able to access discord.ext.commands.Bot's Voice Clients, which can allow you to see voice activity.

from discord.utils import get

@client.command(name="voice")
async def voice(ctx):
    voice_client = get(client.voice_clients, guild=ctx.guild)

    if not voice_client:
        return await ctx.reply("I am not currently connected to a voice channel!")

    voice_channel = voice_client.channel
    voice_channel_id = voice_channel.id
  • Related