简体   繁体   中英

Get the channel of the Bot? Discord.py

I want to know in which discord voice channel the bot is. I only found a way to know in which voice channel the user is with:

@client.command()
async def write(ctx):
    channel = ctx.message.author.voice.channel
    print(channel)

Thanks for your help!

From the API it's in the VoiceClient :

@client.command()
async def write(ctx):
    channel = ctx.voice_client.channel
    print(channel)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM