【发布时间】:2019-11-21 04:24:51
【问题描述】:
所以我在 Python3.7 中使用新的 discord.py 重写编写了一个不和谐机器人,我遇到了一个关于在 VoiceClient 上调用的 disconnect() 函数的问题
我的代码如下:
@bot.command()
async def leave(ctx):
if ctx.author.voice is None:
await ctx.send("Im not in a channel ")
return
await ctx.voice_client.disconnect()
这是一个非常简单的命令,使用 discord.py 的命令扩展名,await ctx.voice_client.disconnect() 行似乎不想工作。
- 运行时没有报错
- 我在
disconnect()行之后直接放置了一个调试print("test")并打印出来 - 我检查了所有的 API,但目前找不到任何有效的方法
- 机器人可以完美加入频道
- 是的,这个
leave命令函数正在被调用 - 即使之前的检查 (
if ctx.author.voice is None:) 在满足条件时也会运行
任何帮助都会很棒,谢谢!
【问题讨论】:
标签: python discord disconnect