<legend id='VixbU'><style id='VixbU'><dir id='VixbU'><q id='VixbU'></q></dir></style></legend>
    • <bdo id='VixbU'></bdo><ul id='VixbU'></ul>
  1. <tfoot id='VixbU'></tfoot>
  2. <small id='VixbU'></small><noframes id='VixbU'>

      <i id='VixbU'><tr id='VixbU'><dt id='VixbU'><q id='VixbU'><span id='VixbU'><b id='VixbU'><form id='VixbU'><ins id='VixbU'></ins><ul id='VixbU'></ul><sub id='VixbU'></sub></form><legend id='VixbU'></legend><bdo id='VixbU'><pre id='VixbU'><center id='VixbU'></center></pre></bdo></b><th id='VixbU'></th></span></q></dt></tr></i><div id='VixbU'><tfoot id='VixbU'></tfoot><dl id='VixbU'><fieldset id='VixbU'></fieldset></dl></div>

      discord.py - 命令引发异常:OpusNotLoaded

      时间:2023-09-09

        <legend id='TB5Dv'><style id='TB5Dv'><dir id='TB5Dv'><q id='TB5Dv'></q></dir></style></legend>
        <i id='TB5Dv'><tr id='TB5Dv'><dt id='TB5Dv'><q id='TB5Dv'><span id='TB5Dv'><b id='TB5Dv'><form id='TB5Dv'><ins id='TB5Dv'></ins><ul id='TB5Dv'></ul><sub id='TB5Dv'></sub></form><legend id='TB5Dv'></legend><bdo id='TB5Dv'><pre id='TB5Dv'><center id='TB5Dv'></center></pre></bdo></b><th id='TB5Dv'></th></span></q></dt></tr></i><div id='TB5Dv'><tfoot id='TB5Dv'></tfoot><dl id='TB5Dv'><fieldset id='TB5Dv'></fieldset></dl></div>

          • <bdo id='TB5Dv'></bdo><ul id='TB5Dv'></ul>

            <small id='TB5Dv'></small><noframes id='TB5Dv'>

              <tbody id='TB5Dv'></tbody>
            1. <tfoot id='TB5Dv'></tfoot>
              • 本文介绍了discord.py - 命令引发异常:OpusNotLoaded的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                我正在制作一个音乐机器人,但我遇到了这个问题,我正在运行 python 3.6.8 并且它托管在 heroku 上

                I was making an music bot but I had it having this problem, im running python 3.6.8 and its hosted on heroku

                我听说我需要使用 discord.opus.LoadOpus 或类似的东西,但我不知道如何将它添加到我的代码以及在哪里,请帮助

                I've heard I need to use discord.opus.LoadOpus or something like that but I dont know how to add it to my code and where, please help

                这是我的代码

                import discord
                import asyncio
                from discord.ext import commands
                
                client = commands.Bot(command_prefix='!')
                songs = asyncio.Queue()
                play_next_song = asyncio.Event()
                
                
                @client.event
                async def on_ready():
                    print('client ready')
                
                
                async def audio_player_task():
                    while True:
                        play_next_song.clear()
                        current = await songs.get()
                        current.start()
                        await play_next_song.wait()
                
                
                def toggle_next():
                    client.loop.call_soon_threadsafe(play_next_song.set)
                
                
                @client.command(pass_context=True)
                async def play(ctx, url):
                    if not client.is_voice_connected(ctx.message.server):
                        voice = await client.join_voice_channel(ctx.message.author.voice_channel)
                    else:
                        voice = client.voice_client_in(ctx.message.server)
                
                    player = await voice.create_ytdl_player(url, after=toggle_next)
                    await songs.put(player)
                
                client.loop.create_task(audio_player_task())
                
                client.run('TOKEN')
                

                我有这个错误:

                Ignoring exception in command play
                Traceback (most recent call last):
                File "/app/.heroku/python/lib/python3.6/site-packages/discord/ext/commands/core.py", line 50, in wrapped
                ret = yield from coro(*args, **kwargs)
                File "Draco.py", line 30, in play
                voice = await client.join_voice_channel(ctx.message.author.voice_channel)
                File "/app/.heroku/python/lib/python3.6/site-packages/discord/client.py", line 3209, in join_voice_channel
                voice = VoiceClient(**kwargs)
                File "/app/.heroku/python/lib/python3.6/site-packages/discord/voice_client.py", line 230, in __init__
                self.encoder = opus.Encoder(48000, 2)
                File "/app/.heroku/python/lib/python3.6/site-packages/discord/opus.py", line 197, in __init__
                raise OpusNotLoaded()
                discord.opus.OpusNotLoaded
                
                The above exception was the direct cause of the following exception:
                
                Traceback (most recent call last):
                File "/app/.heroku/python/lib/python3.6/site-packages/discord/ext/commands/bot.py", line 846, in process_commands
                yield from command.invoke(ctx)
                File "/app/.heroku/python/lib/python3.6/site-packages/discord/ext/commands/core.py", line 374, in invoke
                yield from injected(*ctx.args, **ctx.kwargs)
                File "/app/.heroku/python/lib/python3.6/site-packages/discord/ext/commands/core.py", line 54, in wrapped
                raise CommandInvokeError(e) from e
                discord.ext.commands.errors.CommandInvokeError: Command raised an exception: OpusNotLoaded:
                

                推荐答案

                你不需要在你的代码中添加任何东西,试着把它添加到你在 Heroku 上的 buildpacks 中:

                You don't need to add anything to your code, try adding this to your buildpacks on Heroku:

                https://github.com/xrisk/heroku-opus.git
                

                这篇关于discord.py - 命令引发异常:OpusNotLoaded的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:如何让我的 discord.py 机器人使用自定义表情符号 下一篇:Discord.py 缺少必需的参数

                相关文章

                最新文章

                <i id='kPl5g'><tr id='kPl5g'><dt id='kPl5g'><q id='kPl5g'><span id='kPl5g'><b id='kPl5g'><form id='kPl5g'><ins id='kPl5g'></ins><ul id='kPl5g'></ul><sub id='kPl5g'></sub></form><legend id='kPl5g'></legend><bdo id='kPl5g'><pre id='kPl5g'><center id='kPl5g'></center></pre></bdo></b><th id='kPl5g'></th></span></q></dt></tr></i><div id='kPl5g'><tfoot id='kPl5g'></tfoot><dl id='kPl5g'><fieldset id='kPl5g'></fieldset></dl></div>
                  <bdo id='kPl5g'></bdo><ul id='kPl5g'></ul>
                1. <legend id='kPl5g'><style id='kPl5g'><dir id='kPl5g'><q id='kPl5g'></q></dir></style></legend>

                  <small id='kPl5g'></small><noframes id='kPl5g'>

                    <tfoot id='kPl5g'></tfoot>