2

I am currently trying to get my discord bot on to Heroku and host it 24/7 but I am having problems.

  1. I uploaded my bot to github https://github.com/zemocode/flankebot/tree/master

  2. I have created the two main files I needed

  3. I clicked deploy branch on Heroku and I'm getting this error.

 !     No default language could be detected for this app.
            HINT: This occurs when Heroku cannot detect the buildpack to use for this application automatically.
            See https://devcenter.heroku.com/articles/buildpacks
 !     Push failed

I have followed tutorials but everyone else has node.js and I so mine doesn't work.

Meraj al Maksud
  • 1,528
  • 2
  • 22
  • 36

2 Answers2

7

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

  1. Install Git and do git init when inside your directory
  2. (If you're using virtualenv or similar go into it and) do pip freeze then copy the contents you get to a file called requirements.txt and save it in the same repository as the bot
  3. Make a file (a file of type file) enter image description here , open it with notepad and write worker: python name_of_bot_file.py and save within the same repository
  1. Make a text file called runtime.txt and paste python-3.6.5 or whichever python version you were using to write the bot and save it in the same repository.

  2. (If you're inside virtualenv get out and) open your console and write heroku login and input your heroku login details

  3. Then do heroku apps:create name_of_app and heroku buildpacks:set heroku/python

  4. Finally, do git push heroku main or git push heroku branch_name:main if you want to only push one branch

Maarten
  • 9
  • 4
Tristo
  • 2,328
  • 4
  • 17
  • 28
  • Im like not understanding. I dont have virtualenv and i have all the shit i need but it didnt work when i tried to push it –  Sep 14 '18 at 02:05
  • [Check this answer out and see if it helps](https://stackoverflow.com/questions/9794413/failed-to-push-some-refs-to-githeroku-com) – Tristo Sep 14 '18 at 08:31
  • to anyone reading this, if you already have a heroku application you will need to add it as a remote via `heroku git:remote -a ApplicationNameHere` – Flying Thunder Jul 23 '20 at 13:29
  • The Python version used in `runtime.txt` will need to be one of the following: https://devcenter.heroku.com/articles/python-support#supported-runtimes – Destaq Feb 24 '21 at 10:22
3

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.

kcomain
  • 13
  • 1
  • 5
javajav
  • 379
  • 3
  • 10