python - 类“Bot”的未解析属性引用“voice_client_in”
问题描述
我想制作一个可以排队歌曲的不和谐机器人。我在这里看到了一个代码,但代码显示了这样的错误:
Traceback (most recent call last):
File "C:\Users\Komputer\PycharmProjects\CiaaBot\venv\lib\site-packages\discord\ext\commands\bot.py", line 902, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\Komputer\PycharmProjects\CiaaBot\venv\lib\site-packages\discord\ext\commands\core.py", line 864, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\Komputer\PycharmProjects\CiaaBot\venv\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Bot' object has no attribute 'is_voice_connected'
那我该怎么办?
解决方案
is_voice_connected
已过时
你应该使用Guild.voice_client
@bot.command()
async def queue(ctx):
if ctx.guild.voice_client: # Its connected to voice
...
推荐阅读
- eclipse - 在 Eclipse 中单击“更新项目”时,src/main/scala 文件夹消失
- python - 无法在 .exe 中运行 Scrapy Spider(终端打开和关闭)
- mysql - 将 mySQL 中的多个单元格拆分为多行
- eclipse - 在 2 个插件 Eclipse rcp 之间动态共享数据
- flutter - Flutter Firestore 计算不起作用
- android - 具有相同键的多个条目的android工作室中的错误
- machine-learning - 如何处理带有列表的属性作为预测/回归模型中的条目?
- html - 菜单按钮定位
- python - Python - 将内置函数与创建的函数联系起来
- python - 如何在 python 中使用 plotly 方法添加标题和副标题