Advertisement
Guest User

Untitled

a guest
Apr 2nd, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. import praw
  2. import time
  3.  
  4. r = reddit = praw.Reddit(client_id='Removed',
  5. client_secret='Removed',
  6. password='Removed',
  7. user_agent='LOLCorrector made by /u/ImAFuton, bot account /u/LOLCorrector',
  8. username='LOLCorrector')
  9.  
  10. words_to_match = ['lul,' 'lel']
  11. cache = []
  12.  
  13. def run_bot():
  14. subreddit = r.subreddit("test")
  15. for comment in r.subreddit('test').comments(limit=25):
  16. print("comment id = {}\ncomment body = {}".format(comment, comment.body))
  17. comment_text = comment.body.lower()
  18. isMatch = any(string in comment_text for string in words_to_match)
  19. if comment.id not in cache and isMatch:
  20. print("Match found! Comment ID: " + comment.id)
  21. comment.reply('What the hell does that acronym stand for? Its lol, not lul or lel!')
  22. print("Reply succesful!")
  23. cache.append(comment.id)
  24.  
  25. while True:
  26. run_bot()
  27. time.sleep(2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement