Guest User

Untitled

a guest
Mar 30th, 2017
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. import praw
  2. import time
  3.  
  4. r = reddit = praw.Reddit(client_id='E6y7VKxigCpZ5Q',
  5. client_secret='JXWgCkgW2kWcn_tX6jhMP7zO1hg',
  6. password='buddy1103',
  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. submission = reddit.submission(id)
  13.  
  14. def run_bot():
  15. print("Grabbing subreddits.")
  16. subreddit = r.subreddit("test")
  17. print("Subreddits gathered, grabbing submissions.")
  18. for submission in subreddit.hot(limit=10)
  19. r.submission(id)
  20. print("Submissions gathered, grabbing comments.")
  21. comments = subreddit.comments(limit=200)
  22. for comment in comments:
  23. comment_text = comment.body.lower()
  24. isMatch = any(string in comment_text for string in words_to_match)
  25. if comment.id not in cache and isMatch:
  26. print("Match found! Comment ID: " + comment.id)
  27. comment.reply('What the hell does that acronym stand for? Its lol, not lul or lel!')
  28. print("Reply succesful!")
  29. cache.append(comment.id)
  30.  
  31. while True:
  32. run_bot()
  33. time.sleep(5)
Add Comment
Please, Sign In to add comment