Guest User

Untitled

a guest
Dec 11th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. import praw
  2. import time
  3.  
  4. processed = []
  5. counter = 0
  6.  
  7. def run():
  8. # log in
  9. redd = praw.Reddit(client_id = client_id,
  10. client_secret = client_secret,
  11. username = username,
  12. password = password,
  13. user_agent = useragent)
  14.  
  15. # get comments
  16. for comment in redd.subreddit('testingground4bots').comments(limit=25):
  17.  
  18. # test to see what comments look like
  19. print(comment)
  20.  
  21. # reply if phrase found
  22. if "test_word" in comment.body.lower() and comment.id not in processed:
  23. comment.reply("Test successful!")
  24. processed.append(comment.id)
  25. print("replied to comment with id {}".format(comment.id))
  26.  
  27. while True:
  28. run()
  29. time.sleep(120)
Add Comment
Please, Sign In to add comment