我不能做一个 python 机器人,语音聊天

时间:2021-02-21 21:31:02

标签: python-3.x discord discord.py bots

@client.command(pass_context=True)
async def join(ctx):
    channel = ctx.message.author.voice.voice_channel
    await client.join_voice_channel(channel)

我有这样的回应

raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Member' object has no attribute 'voice_channel'

1 个答案:

答案 0 :(得分:0)

试试这个:

@client.command()
async def join(ctx):
    voice_channel = ctx.author.voice.channel
    vc = await voice_channel.connect()