所以我试图托管一个用python制造的小型discord bot,它在本地运行良好,但是当我部署到heroku时,就会出现此错误。
2020-09-28T14:30:15.338753+00:00 heroku[worker.1]: Starting process with command `python bot.py`
2020-09-28T14:30:15.949195+00:00 heroku[worker.1]: State changed from starting to up
2020-09-28T14:30:19.481846+00:00 heroku[worker.1]: Process exited with status 0
2020-09-28T14:30:19.521977+00:00 heroku[worker.1]: State changed from up to crashed
2020-09-28T14:30:19.524297+00:00 heroku[worker.1]: State changed from crashed to starting
2020-09-28T14:30:23.686504+00:00 heroku[worker.1]: Starting process with command `python bot.py`
2020-09-28T14:30:24.559578+00:00 heroku[worker.1]: State changed from starting to up
2020-09-28T14:30:29.094293+00:00 heroku[worker.1]: Process exited with status 0
2020-09-28T14:30:29.139007+00:00 heroku[worker.1]: State changed from up to crashed
这是github仓库:https : //github.com/ghosts-power/Discord_bot我认为procfile是一个问题,我不知道如何解决。
与无关procfile
。代码0表示您执行的代码没有任何错误。
问题在于bot.py
文件中没有任何执行。您需要致电:
bot.run(token)
在文件末尾。
您还可以使用:
@client.event
async def on_ready():
print(f'{client.user} has connected do Discord')
这将告诉您机器人何时连接到服务器。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句