Search code examples
python-3.xherokudiscord.py

Music bot not playing music on Heroku but is locally


I have a music bot and it works fine. When hosted locally, the bot plays the music as it should when running the play command. But once I hosted the bot on Heroku, the bot only joins the voice channel but doesn't output any sound. The strangest part of all this is that Discord indicates that the bot is playing sounds, as you can see in this image.

How can I fix this? I feel like it has something to do with Heroku, but I don't know what. I also added this Buildpack: https://github.com/jonathanong/heroku-buildpack-ffmpeg-latest.git to my app, but it's still not working.

How can I fix this problem?


Solution

  • Since a response only took place via the comments I will summarize the whole thing again for other users.

    To play music at Heroku mostly 2 buildpacks are necessary. These can be added to the corresponding app under Settings. The following buildpacks are needed:

    1. https://github.com/jonathanong/heroku-buildpack-ffmpeg-latest
    2. https://github.com/xrisk/heroku-opus

    Only then the bot will probably play music, because Heroku has its problems with FFMPEG. After you have added these two buildpacks you can select Deploy Branch under the category Deploy.

    Of course you should also add a buildpack for your system (Python, JS, etc.).