【问题标题】:heroku deployment, libopus not foundheroku 部署,找不到 libopus
【发布时间】:2020-08-09 19:04:37
【问题描述】:

我正在尝试在 heroku 中托管一个不和谐的音乐机器人,但即使它在我的本地机器上运行良好,它似乎也无法找到部署的 libopus 库。

这是我的 requirements.txt 文件:

aiohttp==1.0.5
async-timeout==2.0.1
beautifulsoup4==4.6.0
certifi==2018.1.18
cffi==1.11.5
chardet==3.0.4
cycler==0.10.0
discord.py[voice]==0.16.12
matplotlib==2.1.0
multidict==4.1.0
numpy==1.13.3
opuslib==3.0.1
pycparser==2.18
PyNaCl==1.0.1
pyparsing==2.2.0
python-dateutil==2.6.1
pytz==2017.3
scikit-learn==0.19.1
scipy==0.19.1
six==1.11.0
sklearn==0.0
websockets==3.4
youtube-dl==2018.4.9

我的文件

libopus0
git
libopus-dev -y
libssl-dev
libffi-dev -y
libsodium-dev -y
:repo:ppa:mc3man/xerus-media -y
build-essential -y
unzip -y
software-properties-common -y

我的构建包

1. https://github.com/heroku/heroku-buildpack-apt.git
2. https://github.com/heroku/heroku-buildpack-apt
3. heroku/python
4. https://github.com/jonathanong/heroku-buildpack-ffmpeg-latest.git
5. https://github.com/Crazycatz00/heroku-buildpack-libopus.git

还有错误日志

2018-04-12T21:48:26.872284+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/discord/client.py", line 307, in _run_event

2018-04-12T21:48:26.872287+00:00 app[worker.1]:     yield from getattr(self, event)(*args, **kwargs)

2018-04-12T21:48:26.872311+00:00 app[worker.1]:   File "main.py", line 113, in on_message

2018-04-12T21:48:26.872313+00:00 app[worker.1]:     music_service.voice_client = await client.join_voice_channel(voice_channel)

2018-04-12T21:48:26.872340+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/discord/client.py", line 3209, in join_voice_channel

2018-04-12T21:48:26.872343+00:00 app[worker.1]:     voice = VoiceClient(**kwargs)

2018-04-12T21:48:26.872369+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/discord/voice_client.py", line 230, in __init__

2018-04-12T21:48:26.872371+00:00 app[worker.1]:     self.encoder = opus.Encoder(48000, 2)

2018-04-12T21:48:26.872397+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/discord/opus.py", line 197, in __init__

2018-04-12T21:48:26.872400+00:00 app[worker.1]:     raise OpusNotLoaded()

2018-04-12T21:48:26.872450+00:00 app[worker.1]: discord.opus.OpusNotLoaded

我已经在很多地方搜索并添加了他们推荐的每个包,但似乎仍然不够。希望有人能帮忙。

【问题讨论】:

    标签: python-3.x heroku discord


    【解决方案1】:

    我遇到了这个问题,现在有了一个可以使用 heroku 的音乐机器人。添加此 buildpack https://github.com/xrisk/heroku-opus.git,然后重新部署您的机器人并重新启动测功机。这应该可以修复错误。如果这仍然不起作用,请尝试添加到代码的开头

    if not discord.opus.is_loaded():
        # the 'opus' library here is opus.dll on windows
        # or libopus.so on linux in the current directory
        # you should replace this with the location the
        # opus library is located in and with the proper filename.
        # note that on windows this DLL is automatically provided for you
        discord.opus.load_opus('opus')
    

    【讨论】:

      【解决方案2】:

      很遗憾,Heroku 无法将适当的语音包发送到 discord,因此您必须自行托管或使用 vps 才能使用音乐。确实有人发现了一个漏洞,但如果它被修补了,你可能无法获得音乐https://i.stack.imgur.com/LWcF4.jpg

      【讨论】:

        猜你喜欢
        • 2019-08-21
        • 1970-01-01
        • 1970-01-01
        • 2022-01-17
        • 2022-01-11
        • 2023-03-10
        • 2019-12-26
        • 2017-02-23
        • 1970-01-01
        相关资源
        最近更新 更多