【发布时间】:2022-11-14 23:14:17
【问题描述】:
vc = bot.get_channel(ctx.author.voice.channel.id)
await vc.connect()
await vc.play(discord.FFmpegPCMAudio(executable="ffmpeg.exe", source="assets/a.mp3"))
这段代码就像 3 个月前一样工作,现在因为语音通道对象 (vc) 没有属性 play 而不能工作。它停止工作的任何原因以及如何解决它?
Ignoring exception in command play:
Traceback (most recent call last):
File "C:\Users\Poco\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "C:\Users\Poco\Desktop\py\elevate\main.py", line 38, in play
await vc.play(discord.FFmpegPCMAudio(executable="ffmpeg.exe", source="assets/ass.mp3"))
AttributeError: 'VoiceChannel' object has no attribute 'play'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\Poco\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\Poco\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\Poco\AppData\Local\Programs\Python\Python310\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: 'VoiceChannel' object has no attribute 'play'
我尝试使用不同的 vcs、服务器、权限,但没有解决问题
【问题讨论】:
标签: python python-3.x discord discord.py