I'm trying to insall this Music Bot application. It works as an application for Discord that plays music upon request. I've been trying to figure out any way of putting those files into a Heroku account so that it would run on my Discord server forever. I want to get a better understanding on how Heroku works with Python files like these.
2 Answers
Create a Heroku Application, then go to 'Settings'. Scroll down to buildpacks, and add three buildpacks, with the following buildpack URLs:
- heroku/python
- https://github.com/heroku/heroku-buildpack-apt.git
- https://github.com/jonathanong/heroku-buildpack-ffmpeg-latest.git
In a text editor, create four files:
requirements.txt
. Add any Python libraries and their code names intorequirements.txt
. Adddiscord.py[voice] ~= 0.16.0
,pip
,youtube_dl
andcolorlog
each one on a new line. Save the file.runtime.txt
Addpython-3.5.2
on the first line of this file. Save the file.Procfile
addworker: python3.5 run.py
to the first line of this file.Aptfile
addlibopus0
,git
,libopus-dev
,libssl-dev
,libffi-dev
,libsodium-dev
,:repo:ppa:mc3man/xerus-media -y
each one on a new line. Save the file.
Now that you've prepared your bot for Heroku installation.
Create a GitHub account if you haven't, create a new repository. Tick the option with 'README.md'. Click, 'upload files', and upload all the files of the Bot. Don't upload the folder itself, upload the contents in the folder.
Once uploaded, head back to your Heroku Application, and go to 'Deploy'. Scroll down, and choose 'GitHub' as your deployment method. Connect your GitHub account, then type the name of the repository you created. Click 'connect'. After it has connected, scroll down, and click 'Deploy branch'.
Wait until your app has received all the data from GitHub. Then, go to 'Resources', flick the switch on, and check the logs to confirm if the Bot is online. Once the bot has connected to Discord, your bot has been hosted!

- 81
- 3
You should checkout the Heroku docs for Python, it's really not that hard
That you will need:
- A fork/clone of above mentioned discord bot
- A
requirements.txt
file which states your pip requirements (already present at the mentioned discord bot) - A
runtime.txt
file which states which interpreter on which version you want to use, i.e.python-3.6.1
- A
Procfile
file which states which Heroku worker should start which script file
After you've done that, you can push your changes via git to your Heroku git repository

- 763
- 10
- 12