问题
I am currently trying to get my discord bot on to Heroku and host it 24/7 but I am having problems.
I uploaded my bot to github https://github.com/zemocode/flankebot/tree/master
I have created the two main files I needed
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.
回答1:
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 initwhen inside your directory - (If you're using virtualenv or similar go into it and) do
pip freezethen copy the contents you get to a file calledrequirements.txtand 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.pyand save within the same repositoryMake a text file called
runtime.txtand pastepython-3.6.5or 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 loginand input your heroku login detailsThen do
heroku apps:create name_of_appandheroku buildpacks:set heroku/pythonFinally, do
git push heroku masterorgit push heroku branch_name:masterif you want to only push one branch
回答2:
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.
来源:https://stackoverflow.com/questions/52247301/how-do-i-host-my-discord-py-bot-on-heroku