【发布时间】:2021-11-08 11:12:33
【问题描述】:
我是新手,正在学习,所以请温柔一点。 我一直在尝试构建一个 Reddit 机器人,托管在 GitHub 上并使用 Heroku 进行部署。 我遇到的大多数问题都可以用谷歌解决。我似乎找不到这个问题的答案。 我的问题在部署日志中,我现在得到的是:
我一直在尽我所能尝试每一条建议,但似乎没有任何效果。 我做错了什么?
我在 GitHub 上的文件是:
skb.py
import praw
import time
reddit = praw.Reddit(
user_agent="redacted" ,
client_id="redacted",
client_secret="redacted",
username="redacted",
password="redacted",)
subreddit = reddit.subreddit("comedy")
joke_reply = ["CAUSE IT'S A JOKE OHH OHHHH OHHHHHHHHH"]
for submission in subreddit.hot(limit=10):
# print(submission.title)
for comment in submission.comments:
if hasattr(comment,"body"):
comment_lower = comment.body.lower()
if " a joke " in comment_lower:
# print("------")
print(comment.body)
comment.reply(joke_reply)
time.sleep(66)
requirements.txt
gunicorn==20.0.4
praw==7.4.0
过程文件
web:gunicorn skb:app
【问题讨论】:
-
请修剪您的代码,以便更容易找到您的问题。请按照以下指南创建minimal reproducible example。
标签: python heroku bots gunicorn praw