Advertisement
gavin19

papa

Feb 15th, 2017
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.78 KB | None | 0 0
  1. import praw
  2.  
  3. reddit = praw.Reddit(client_id='ID_here',
  4.                      client_secret='secret_here',
  5.                      username='username_here',
  6.                      password='password_here',
  7.                      user_agent='user_agent_here')
  8.  
  9. print(reddit.user.me())
  10.  
  11. sub = reddit.subreddit('all')
  12. sub.filters.add('literallyanysubreddithere')
  13. comments = sub.stream.comments()
  14.  
  15. for comment in comments:
  16.     text = comment.body
  17.     author = comment.author
  18.     subname = comment.subreddit
  19.     if comment.author != "mybotname":
  20.         if "triggerword" in text and "otherword" not in text:
  21.             message = "Message here."
  22.             comment.reply(message)
  23.             print('Comment found and reply to user "{1}" posted in subreddit "{0}"!'.format(subname, author))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement