How do I host my discord.py bot on heroku?
You're missing a couple of things to make this work, for the sake of everyone Googling how to host discord.py on Heroku and getting this as the top result here's a step-by-step
- Install Git and do
git init
when inside your directory - (If you're using virtualenv or similar go into it and) do
pip freeze
then copy the contents you get to a file calledrequirements.txt
and save it in the same repository as the bot Make a file (a file of type file) , open it with notepad and write
worker: python name_of_bot_file.py
and save within the same repositoryMake a text file called
runtime.txt
and pastepython-3.6.5
or whichever python version you were using to write the bot and save it in the same repository.(If you're inside virtualenv get out and) open your console and write
heroku login
and input your heroku login detailsThen do
heroku apps:create name_of_app
andheroku buildpacks:set heroku/python
Finally, do
git push heroku master
orgit push heroku branch_name:master
if you want to only push one branch
your procfile isn't right. a web application(web:<command>
) is for websites (which your bot isn't). the right one is worker: python3 bot.py
.
Also, you need a requirements.txt
. inside the file, write every module you need to download. in your case, its just discord.py
.