【发布时间】:2019-08-28 22:15:11
【问题描述】:
好的,我正在尝试制作一个 Discord.py 机器人。我做到了,但现在我无法主持它。当我尝试(在 Heroku 上)时,测功机永远不会出现。这是 GitHub 链接:https://github.com/EchoNoahGaming/echobot/
我希望它有一个 Dyno,但它没有。
Procfile 中只有“worker: pybot.py”,并且在它的日志中显示
2019-04-07T17:07:09.025914+00:00 heroku[router]: at=info code=H81 desc="Blank app" method=GET path="/" host=echobotyeet.herokuapp.com request_id=1330f84d-51a4-4462-9de1-cbea09bc621b fwd="172.6.17.203" dyno= connect= service= status=502 bytes= protocol=https
2019-04-07T17:07:11.185818+00:00 heroku[router]: at=info code=H81 desc="Blank app" method=GET path="/favicon.ico" host=echobotyeet.herokuapp.com request_id=93b077ec-61de-4e5f-b7e3-e9e2a0674546 fwd="172.6.17.203" dyno= connect= service= status=502 bytes= protocol=https
一些主要的机器人是
@bot.event
async def on_ready():
print('Logged in as')
print(bot.user.name)
print(bot.user.id)
print('------')
@bot.command()
async def announcement(ctx, *, args):
"""Announcement command!"""
embed=discord.Embed(title="Announcement", description=args, color=0x7700aa)
embed.set_footer(text="By EchoNoahGaming")
await ctx.send("@everyone", embed=embed)
client.run(str(os.environ.get('BOT_TOKEN')))
【问题讨论】:
-
您是否收到任何错误或日志?
-
欢迎来到 Stack Overflow。请使用tour 并阅读How to Ask。问题必须是独立的;我们不会去场外挖掘您的代码并发现问题。请edit 您的问题并添加您的
Procfile以及主脚本的合理部分。理想情况下,我们希望看到minimal reproducible example。 -
这是你的第一个问题。你只是在定义一个工人。 Heroku 托管 web 应用程序。
pybot.py是否会生成一个 Web 服务器并监听 HTTP 请求? (您没有像我要求的那样包含主脚本的任何部分。这两个日志条目是无关紧要的。) -
您希望您的
pybot.py接收来自 Heroku 外部的 HTTP 请求吗?如果是这样,它应该是一个web进程。如果没有,你有scaled your worker up吗? -
...您是否费心点击我精心提供的链接?它提供了很多关于扩展过程的细节。请不要叫我“兄弟”。
标签: python heroku discord.py