如何在heroku上托管我的discord.py机器人? [英] How do I host my discord.py bot on heroku?

查看:139
本文介绍了如何在heroku上托管我的discord.py机器人?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在尝试将Discord机器人安装到Heroku上并全天候24/7托管它,但是我遇到了问题。


  1. 我将我的机器人上传到了github
    ,用记事本打开它并编写 worker:python name_of_bot_file.py 并保存在同一存储库中


  2. 制作一个名为 runtime.txt 的文本文件,并粘贴 python-3.6。 5 或您用来编写漫游器并将其保存在同一存储库中的任何Python版本。


  3. (如果您在virtualenv内部,打开)并输入 heroku登录并输入您的heroku登录详细信息


  4. 然后执行 heroku apps:创建name_of_app heroku buildpacks:set heroku / python


  5. 最后,在以下情况下执行 git push heroku master git push heroku branch_name:master 您只想推送一个分支



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.

解决方案

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) , open it with notepad and write worker: python name_of_bot_file.py and save within the same repository

  4. 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.

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

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

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

这篇关于如何在heroku上托管我的discord.py机器人?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆