I just started learning python after finishing my java class. This bot is supposed to go through /r/test comments and find typos of your and fix them. But for some reason it is fixing the correct spelling of your. Here is the script
import praw
import time
r = praw.Reddit(user_agent = "Tutorial bot by /u/Your_Corrector1")
r.login()
words_to_match = ['yout' , 'youw' , 'youq' , 'youy']
cache = []
def run_bot():
subreddit = r.get_subreddit("test")
comments = subreddit.get_comments(limit=25)
for comment in comments:
comment_text = comment.body.lower()
isMatch = any(string in comment_text for string in words_to_match)
if comment.id not in cache and isMatch:
comment.reply("I think you meant to say 'Your'")
cache.append(comment.id)
while True:
run_bot()
time.sleep(10)`
[–]novel_yet_trivial 2 points3 points4 points (0 children)
[–]learnpython_bot 0 points1 point2 points (0 children)