试图让我的不和谐机器人通过Heroku运行起来。部署成功了,但机器人在不和谐的情况下脱机。
日志告诉我,在机器人(我命名为Giphy.py)的代码中发生了一些事情。
日志:
Starting process with command `python giphy.py`
2022-01-13T11:23:28.488578+00:00 heroku[worker.1]: State changed from starting to up
2022-01-13T11:23:28.964012+00:00 app[worker.1]: Traceback (most recent call last):
2022-01-13T11:23:28.964026+00:00 app[worker.1]: File "/app/giphy.py", line 3, in <module>
2022-01-13T11:23:28.964082+00:00 app[worker.1]: import giphy_client
2022-01-13T11:23:28.964083+00:00 app[worker.1]: ModuleNotFoundError: No module named 'giphy_client'代码:
import random
import discord
import giphy_client
from discord.ext.commands import Bot
from giphy_client.rest import ApiException
...
...我可以看到它导致了一个ModuleNotFoundError,但是,由于我已经使机器人在本地工作,并且考虑到我对Python和机器人的世界还很陌生,我现在不知道该做什么。有办法导入giphy_client吗?或者我应该做一些不同的事情来解决这个问题,让我的机器人在网上运行?感谢所有反馈。再说一遍,我还是很新的!
发布于 2022-01-14 12:01:53
找到解决办法了!这是答案
"requirements.txt“文件,它包含如下内容:
错过了我还需要的一件事: giphy_client==1.0.0。
添加此操作后,bot已联机并可在服务器中使用。
https://stackoverflow.com/questions/70696710
复制相似问题