我正在尝试使用 Raspberry Pi 托管我的 Discord Bot。 Bot 运行,但我的命令文件在另一个文件夹中,该文件夹将无法运行。在 Windows 上它工作得很好。我只收到 9 次失败错误。
@bot.event
async def on_ready():
print("Start was successful")
for filename in os.path.dirname(os.path.realpath(__file__)):
if filename.endswith(".py") and filename != "__init__.py":
bot.load_extension(f'cogs.{filename[:-3]}')
else:
print("Fail")
bot.run(token)
我的输出:
Fail (9 times)
Start was successful