Guest User

Reddit Bot

a guest
Oct 19th, 2016
29
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.59 KB | None | 0 0
  1. import praw
  2. file = open("pepe.txt", "a")
  3. bot = praw.Reddit(user_agent='StupidBot v0.1',
  4.                   client_id='secret :P',
  5.                   client_secret='secret :P',
  6.                   username='sn0wr4in',
  7.                   password='nop, also secret :P')
  8. subreddit = bot.subreddit('all')
  9. comments = subreddit.stream.comments()
  10. for comment in comments:
  11.     text = comment.body # Fetch body
  12.     author = comment.author # Fetch author
  13.     if ('a' or 'b' or 'hello' or 'I') in text.lower():  //a simple condition just to test
  14.             file.write('{0} {1}\n'.format(comment, author))
Add Comment
Please, Sign In to add comment