Advertisement
Guest User

Untitled

a guest
Feb 19th, 2021
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.47 KB | None | 0 0
  1. import praw
  2. import random
  3.  
  4. reddit = praw.Reddit(
  5.     client_id="",
  6.     client_secret="",
  7.     user_agent="",
  8.     username="",
  9.     password=""
  10. )
  11.  
  12. hi_quotes = ['ok', 'bosf']
  13. subreddit = 'redditdev'
  14.  
  15. for comment in reddit.subreddit(subreddit).stream.comments(skip_existing=True):
  16.     if "hi" in comment.body.lower():
  17.         print(f"Matched comment {comment.id} - now replying")
  18.         random_index = random.randint(0,len(hi_quotes)-1)
  19.         comment.reply(str(hi_quotes[random_index]))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement