This is the same old bot running on the Discord Server of CSUL, but i've changed the code. It's better now.

How i did

The bot is now running on Heroku servers, using only free features. There are some new commands on Heroku CLI that can be a problem if you don't pay attention.
I'll list some things i almost miss while read the documentations, on the first attempt to host this bot.

→ Create Python reference

  • Heroku won't able the buildpacks if they don't be referred. I used heroku buildpacks:set heroku/python to set it.
  • This can be configurated at the heroku create command, creating the app and setting the buildpack inside.

→ Set Procfile and requirements

  • These two files must be created at the same directory as the .py script. The Procfile can't have a extension, and will contain the web/worker dynos to
    actually connect the app to Heroku.
  • I downloaded gunicorn to use these dynos properly, but i don't really needed it at all. All i had to do was run the dynos with the python parameter.


  • The requirements.txt has to contain all the packages/versions that are being used on the application. I also forgot to put a "discord==1.0.1" line to invoke the
    main discord package.
  • On Heroku CLI, i had to make a heroku ps:scale web=1 worker=1 after update the Procfile. This line sets the amount of dynos that the application will use.
    Also, i had to enable the options of web and worker (after commit) on Heroku dashboard resources page.

Heroku Resources

→ Switch branches and deploy

  • Yes, i was in the remote branch master, which was used to be the default branch for Heroku. However, i had to change it to the main branch, using the
    command line git checkout main. After doing this, the code was able to actually being pushed.
  • The code i edit is on master branch (Github), i just switch to main everytime i need to push it to Heroku. So, the first time i deployed, the bot was
    pinging each 30 seconds, and logging twice. The problem here was the unnecessary use of gunicorn, which runs a new server online, so i just had to remove
    the line reference "web: gunicorn main:app" of the Procfile, replacing by the python that was mentioned before. I've added the worker dyno,
    edited some lines of the code and pushed it. The bot is on, working fine.


I'll update every change or issue on the application, this .readme just tells the things i did to solve some problems. If there's something that can be changed or
solved in a better way, i can edit the text anytime, so it can be helpful to others.