获取 bot 连接的语音通道的 id

Get id of voice channel where bot is connected to

我想获取机器人连接的语音通道的语音通道ID。有什么命令吗?

您可以访问 discord.ext.commands.Bot 的语音客户端,它可以让您看到语音 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