Skip to content

Instantly share code, notes, and snippets.

Last active February 17, 2021 00:24
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
BBoe's Updates to "How To Make A reddit Bot — Part One"
I'm Bryce (/u/bboe) Author of PRAW
/u/busterroni's Submission:
/u/busterroni's Part 1:
1) Convert for python 3.6 (done)
2) Use `reddit` instead of `r` (done)
3) Use main function (done)
4) Change `bot_login` to `authenticate` (done)
5) Use praw.ini (done)
6) Address flake8 issues
# Note: these credentials were revoked before being made public
client_id: EBhviLF4IW1LQA
client_secret: dEoavAgJ5OO-eHLBwemY4Z7y3m8
password: notarealpassword
username: pyapitestuser2
# copyright (c) busterroni February 18, 2017
# video:
# Updates by Bryce Boe (/u/bboe)
import praw
import time
REPLY_MESSAGE = ("I also love dogs! [Here]( is "
"an image of one!")
def authenticate():
reddit = praw.Reddit(
user_agent="busterronitest's dog comment responder v0.1")
print("Authenticated as {}".format(
return reddit
def main():
reddit = authenticate()
while True:
def run_bot(reddit):
print("Obtaining 25 comments...")
for comment in reddit.subreddit('test').comments(limit=25):
if "dog" in comment.body:
print('String with "dog" found in comment {}'.format(
print("Replied to comment " +
print("Sleeping for 10 seconds...")
# Sleep for 10 seconds...
if __name__ == '__main__':
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment