代码:
async def memesoundeffect(self, ctx):
if await checkroles(ctx, ctx.author):
async with ctx.typing():
player = await YTDLSource.from_url("https://www.youtube.com/watch?v=J85jV37CsYE&list=PLWL3FzHaRRMkQqUhks8Y9l35rqY_kKCto&index=1", loop=self.bot.loop, stream=True)
ctx.voice_client.play(player, after=lambda e: print("Player error: %s" % e) if e else None)
print()
await ctx.send("Now playing: {}".format(player.title))
else:
await ctx.channel.send("You do not have the required permissions for this command. Requirements: Admin+")
print()
当我运行它时,这是我得到的错误:
Traceback (most recent call last):
File "/Users/anna54office/PycharmProjects/DiscordtestBot/venv/lib/python3.9/site-packages/discord/ext/commands/bot.py", line 902, in invoke
await ctx.command.invoke(ctx)
File "/Users/anna54office/PycharmProjects/DiscordtestBot/venv/lib/python3.9/site-packages/discord/ext/commands/core.py", line 864, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "/Users/anna54office/PycharmProjects/DiscordtestBot/venv/lib/python3.9/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: 'NoneType' object has no attribute 'play'
我怎样才能解决这个问题
这样做不是更容易吗
相关问题 更多 >
编程相关推荐