Python 3.x Python-如何生成join命令

Python 3.x Python-如何生成join命令,python-3.x,discord.py,discord.py-rewrite,Python 3.x,Discord.py,Discord.py Rewrite,我正在尝试为我的机器人创建一个“.join”命令,但我尝试的一切都没有成功&我尝试了很多方法 以下是我尝试过的一些方法,我也尝试过其他一些方法: @client.command(pass_context=True) async def join(ctx): channel=ctx.message.author.voice.VoiceChannel await client.join_VoiceChannel(channel) 它给出了以下错误: discord.ext.commands.

我正在尝试为我的机器人创建一个“.join”命令,但我尝试的一切都没有成功&我尝试了很多方法

以下是我尝试过的一些方法,我也尝试过其他一些方法:

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

 await client.join_VoiceChannel(channel)
它给出了以下错误:
discord.ext.commands.errors.CommandInvokeError:Command引发了异常:AttributeError:“VoiceState”对象没有属性“VoiceChannel”
您可以使用
加入语音频道
使bot按照 试试这个:

@client.command(pass\u context=True)
异步def联接(ctx):
author=ctx.message.author
等待机器人加入语音频道(作者语音频道)
适用于旧版本的discord.py

此代码块应该可以工作:

@client.command(pass\u context=True)
异步def联接(ctx):
message=ctx.message
channel_id=ctx.message.author.voice.channel.id
通道=客户端。获取通道(通道id)
等待通道连接()

对你有用吗?我相信您正在调用author.voice.VoiceChannel,应该只是调用author.VoiceChannel。我现在收到此错误
discord.ext.commands.errors.CommandInvokeError:Command引发了一个异常:AttributeError:“Member”对象没有属性“voice\u channel”
,而与
author.VoiceChannel
相同无属性连接\u语音\u频道是否出现错误?是否确定使用异步?您可能已经安装了“重写”。在python中输入
导入discord;打印(discord.\uuuu version\uuuuuu)
检查您的版本或discord.py,如果是异步的,那么idk脚本有什么问题如果是重写,那么您的脚本是错误的,如果给定的版本是1.0.0或更高,那么您使用的是重写,但是如果它小于1.0.0,那么它是异步的(我也建议您使用重写)我使用的是重写,我喜欢了解最新情况
join_voice_channel