Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import praw
- import time
- r = reddit = praw.Reddit(client_id='E6y7VKxigCpZ5Q',
- client_secret='JXWgCkgW2kWcn_tX6jhMP7zO1hg',
- password='buddy1103',
- user_agent='LOLCorrector made by /u/ImAFuton, bot account /u/LOLCorrector',
- username='LOLCorrector')
- words_to_match = ['lul,' 'lel']
- cache = []
- submission = reddit.submission(id)
- def run_bot():
- print("Grabbing subreddits.")
- subreddit = r.subreddit("test")
- print("Subreddits gathered, grabbing submissions.")
- for submission in subreddit.hot(limit=10)
- r.submission(id)
- print("Submissions gathered, grabbing comments.")
- comments = subreddit.comments(limit=200)
- for comment in comments:
- 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(5)
Add Comment
Please, Sign In to add comment