Skip to content

Instantly share code, notes, and snippets.

@gavin19
Last active December 20, 2018 20:05
Show Gist options
  • Save gavin19/dd6325bc4a074a6d40c44992b0082ff5 to your computer and use it in GitHub Desktop.
Save gavin19/dd6325bc4a074a6d40c44992b0082ff5 to your computer and use it in GitHub Desktop.
import praw
SUB = "somesub" # subreddit to watch for comments
TO_SKIP = ['HappySilveon', 'AutoModerator'] # list of users to ignore
SUBJECT = "Some subject" # required subject for the PM
REPLY = "PM content here." # The content of the PM we'll respond with
def main():
reddit = praw.Reddit(user_agent='/u/HappySilveon reply script',
client_id='CLIENT_ID', client_secret='CLIENT_SECRET',
username='USERNAME', password='PASSWORD')
sub = reddit.subreddit(SUB)
for cmt in sub.stream.comments(skip_existing=True):
user = str(cmt.author)
if user not in TO_SKIP:
reddit.redditor(user).message(SUBJECT, REPLY)
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment