Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import praw
- import time
- r = reddit = praw.Reddit(client_id='Removed',
- client_secret='Removed',
- password='Removed',
- user_agent='LOLCorrector made by /u/ImAFuton, bot account /u/LOLCorrector',
- username='LOLCorrector')
- words_to_match = ['lul,' 'lel']
- cache = []
- def run_bot():
- subreddit = r.subreddit("test")
- for comment in r.subreddit('test').comments(limit=25):
- print("comment id = {}\ncomment body = {}".format(comment, comment.body))
- 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:
- print("Match found! Comment ID: " + comment.id)
- comment.reply('What the hell does that acronym stand for? Its lol, not lul or lel!')
- print("Reply succesful!")
- cache.append(comment.id)
- while True:
- run_bot()
- time.sleep(2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement