我在GitHub上找到了这个reddit机器人代码,它实际上只是一个注释机器人。
https://github.com/yashar1/reddit-comment-bot
我对Python知之甚少,因此我尝试对代码进行修改以使其具有多个subreddit和关键字,并添加以下内容:
"React Native combines smoothly with components written in Swift, Java, or Objective-C. It's simple to drop down to native code if you need to optimize a few aspects of your application"
此代码似乎无效,主要是由于我对Python的了解有限。我希望该机器人扫描多个subreddit并搜索多个关键字。
谢谢。
答案 0 :(得分:0)
您可以像这样包含多个子索引。
subreddits_list = "test+bottest"
subreddits = r.subreddit(subreddits_list)
要检查多个关键字,可以使用。
keywords = ["hello", "okay"]
for comment in subreddits.comments(limit=100):
for keyword in keywords:
if keyword in comment.body and comment.id not in comments_replied_to and comment.author != r.user.me():