【发布时间】:2019-12-19 08:36:28
【问题描述】:
我在 Discord 中制作了一个供我个人使用的小型机器人,我想将它托管在 Heroku 上,但我在部署应用程序时遇到了麻烦,代码位于 github 上的私有存储库中
我已经制作了Procfile、requirement.txt和runtime.txt
几个月前,我制作了另一个 discord.py 机器人(discord.py 的异步版本),并且我使用了与现在想要使用的相同的文件。
我的Procfile:
worker: python3 Main.py
我的requirements.txt:
discord.py==1.2.3
我的runtime.txt:
python-3.7.4
我的python代码
import os
import discord
from discord.ext import commands
client = commands.Bot(command_prefix = "/")
client.remove_command('help')
#Event
@client.event
async def on_ready():
print("Kitsune Bot : Online")
for files in os.listdir('./cogs'):
if files.endswith('.py'):
try:
client.load_extension(f'cogs.{files[:-3]}')
print("{} is running !".format(files))
except Exception as error:
print(error)
client.run(<myToken>)
预期结果是机器人上线并响应我所有的函数调用,但实际结果是在 heroku 上部署应用程序时出错:
-----> Installing python-3.7.4
-----> Installing pip
-----> Installing requirements with pip
! Push rejected, failed to compile Python app.
! Push failed```
【问题讨论】: