Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/320.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python discord.py-channel.connect()不工作_Python_Python 3.x_Discord.py_Discord.py Rewrite - Fatal编程技术网

Python discord.py-channel.connect()不工作

Python discord.py-channel.connect()不工作,python,python-3.x,discord.py,discord.py-rewrite,Python,Python 3.x,Discord.py,Discord.py Rewrite,我正在尝试将我的机器人连接到一个语音频道,并尝试了我能在网上找到的所有解决方案,但没有任何效果。 当我调用wait channel.connect()时,程序只是挂起,什么也不做 代码段: @commands.command() async def join(self, ctx): if not ctx.message.author.voice: ctx.send("You are not in a voice channel") else:

我正在尝试将我的机器人连接到一个语音频道,并尝试了我能在网上找到的所有解决方案,但没有任何效果。 当我调用
wait channel.connect()
时,程序只是挂起,什么也不做

代码段:

@commands.command()
async def join(self, ctx):
    if not ctx.message.author.voice:
        ctx.send("You are not in a voice channel")
    else:
        channel = ctx.message.author.voice.voice_channel
        await channel.connect()

我认为你需要改变


ctx.message.author.voice.voice\u频道
进入
ctx.message.author.voice.channel
首先,你没有等待
ctx.send
,其次是
不和谐。VoiceState
没有属性
voice\u频道
,它是
频道

以下是固定代码:

@commands.command()
异步def联接(自、ctx):
如果不是ctx.author.voice:
等待ctx.send(“您不在语音频道中”)
其他:
频道=ctx.author.voice.channel
等待通道连接()

更改了,但仍然无效。我尝试了您的解决方案,但仍然无效。bot有管理员权限BTWD您是否有
意图。成员
已启用?是的,我已经踢了并重新邀请了bot。您确定您已启用意图吗?是的,在discord开发门户和我的代码中都是如此