Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import praw
- import time
- processed = []
- counter = 0
- def run():
- # log in
- redd = praw.Reddit(client_id = client_id,
- client_secret = client_secret,
- username = username,
- password = password,
- user_agent = useragent)
- # get comments
- for comment in redd.subreddit('testingground4bots').comments(limit=25):
- # test to see what comments look like
- print(comment)
- # reply if phrase found
- if "test_word" in comment.body.lower() and comment.id not in processed:
- comment.reply("Test successful!")
- processed.append(comment.id)
- print("replied to comment with id {}".format(comment.id))
- while True:
- run()
- time.sleep(120)
Add Comment
Please, Sign In to add comment