Advertisement
Guest User

Untitled

a guest
Apr 1st, 2017
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 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. sub = r.subreddit('test')
  16. for c in sub.stream.comments():
  17. print(r.comment(c).body())
  18. for comment in comments:
  19. comment_text = comment.body.lower()
  20. isMatch = any(string in comment_text for string in words_to_match)
  21. if comment.id not in cache and isMatch:
  22. print("Match found! Comment ID: " + comment.id)
  23. comment.reply('What the hell does that acronym stand for? Its lol, not lul or lel!')
  24. print("Reply succesful!")
  25. cache.append(comment.id)
  26.  
  27. while True:
  28. run_bot()
  29. time.sleep(2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement