小编Max*_*thy的帖子

检查用户是否在语音频道discord.py

我正在制作一个可以在 vc 中播放声音的机器人。我已经编写了代码来加入通话,播放 mp3,然后离开通话,但是当用户不在通话中时,我收到此错误:

Ignoring exception in command ring:
Traceback (most recent call last):
  File "C:\Users\max\AppData\Roaming\Python\Python39\site-packages\discord\ext\commands\core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "C:\Users\max\OneDrive\Desktop\Code\DiscordBots\Nokia\Nokia.py", line 91, in ring
    channel = ctx.author.voice.channel
AttributeError: 'NoneType' object has no attribute 'channel'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\max\AppData\Roaming\Python\Python39\site-packages\discord\ext\commands\bot.py", line 903, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Users\max\AppData\Roaming\Python\Python39\site-packages\discord\ext\commands\core.py", line 859, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Users\max\AppData\Roaming\Python\Python39\site-packages\discord\ext\commands\core.py", line 94, in wrapped …
Run Code Online (Sandbox Code Playgroud)

python ffmpeg discord.py

1
推荐指数
1
解决办法
1万
查看次数

标签 统计

discord.py ×1

ffmpeg ×1

python ×1