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开发门户和我的代码中都是如此