【问题标题】:Command raised an exception: OpusNotLoaded:命令引发异常:OpusNotLoaded:
【发布时间】:2018-12-09 09:36:14
【问题描述】:

我刚开始用 discord.py 编写一个不和谐机器人,一切都很完美。 除了一件事:我不能让机器人播放音乐。

这是我的代码:

@client.command(pass_context=True)
async def yt(ctx, url):

    author = ctx.message.author
    voice_channel = author.voice_channel
    vc = await client.join_voice_channel(voice_channel)

    player = await vc.create_ytdl_player(url)
    player.start()

我的错误:

discord.ext.commands.errors.CommandInvokeError: 
Command raised an exception: 
OpusNotLoaded:

为什么会这样?

【问题讨论】:

    标签: python discord.py


    【解决方案1】:

    您需要使用discord.opus.load_opus 来加载Opus 库。

    【讨论】:

    • 我应该导入这个吗?
    • 是的。您还应该确保在运行机器人的计算机上安装了libopus
    猜你喜欢
    • 2019-09-19
    • 2021-10-07
    • 1970-01-01
    • 2019-12-08
    • 2022-01-16
    • 1970-01-01
    • 1970-01-01
    • 2011-01-14
    • 1970-01-01
    相关资源
    最近更新 更多