Reddit Reply Bot




Introduction: Reddit Reply Bot

The purpose of this instruction set is to build a simple Reddit bot. A Reddit bot is a program which scans posts/comments on Reddit, and can react to the information it collects. This can be important for many reasons, like getting familiar with the Reddit API (Application Programming Interface) using PRAW or to easily reply to multiple posts at once. In order to compete this, you must have a Reddit account, should have some familiarity with coding in Python and need to have your system PATH variable for Python set up so you can compile Python at the command line or terminal. If none of that makes sense to you, you are probably not prepared for this tutorial. If these steps are done correctly, this should be finished in no more than 30 minutes. Good luck and I hope you find this informative, happy botting!

Step 1: Login and Create Personal App

First login into Reddit or make an account and go to to create a personal app.

Step 2: Create App

Name the app and make sure the script circle is filled, also add a name and description to app (can be anything), you can use a random url for the redirect url such as http://localhost:

Step 3: App Screen

Once you have created the app, you are given a ‘personal use script’ and ‘secret’, make sure you remember what those are, very important.

Step 4: Make RedditBot Folder and Open CMD

Create a new folder on your desktop called, “RedditBot” and open up cmd or terminal. Then, go to it's directory using cd /Users/Admin/Desktop/RedditBot. Also make sure to replace Admin with your user account.

Step 5: Pip Install PRAW

Then, type the command python -m pip install praw, skip if you already have installed.

Step 6: Drag Praw.ini File Into Folder

Once you’ve done that, go to where you installed Python and type in finder praw.ini, take that file and drag it into your RedditBot folder. Most likely Python will be installed under Users and AppData in the C drive.

Step 7: Make a New Python File

Open up Python IDLE or equivalent text editor and create a new file called Make sure to save it in your RedditBot folder you made in step 4.

Step 8: Paste the Code

After you created that file, paste this code with minor adjustments. Change the username and password fields to your own, the user_agent can be anything, the client_id is your personal use script from step 3, and client_secret is your secret from step 3. Also, when pasting this code make sure the indentations are the same as the picture above. Also make sure that each variable you enter is in the quotations.

import praw

#Enter your correct Reddit information into the variable below

userAgent = 'Enter Bot name'

cID = 'Enter your personal use script'

cSC= 'Enter you client secret'

userN = 'Enter your Reddit username'

userP ='Enter your Reddit password'

numFound = 0

reddit = praw.Reddit(user_agent=userAgent, client_id=cID, client_secret=cSC, username=userN, password=userP)

subreddit = reddit.subreddit('weather') #any subreddit you want to monitor

bot_phrase = 'Aw shucks, looks like I am staying in >:(' #phrase that the bot replies with

keywords = {'Cold', 'chicago', 'polar', 'vortex'} #makes a set of keywords to find in subreddits

for submission in #this views the top 10 posts in that subbreddit

n_title = submission.title.lower() #makes the post title lowercase so we can compare our keywords with it.

for i in keywords: #goes through our keywords

if i in n_title: #if one of our keywords matches a title in the top 10 of the subreddit

numFound = numFound + 1

print('Bot replying to: ') #replies and outputs to the command line

print("Title: ", submission.title)

print("Text: ", submission.selftext)

print("Score: ", submission.score)


print('Bot saying: ', bot_phrase)



if numFound == 0:


print("Sorry, didn't find any posts with those keywords, try again!")

Step 9: Run Your Code!

Then save the file in your RedditBot folder and run it on cmd with

Step 10: And That's It!

Now you should have a working Reddit bot, capable of scanning through your favorite subreddit and responding automatically with a desired phrase. You can also use this code as a good starting point for other Reddit bot ideas, which could be anything from converting temperatures, to replying to people with cat pictures. Thanks for reading through, hope this was useful and good luck on any future projects.

Be the First to Share


    • Game Design: Student Design Challenge

      Game Design: Student Design Challenge
    • For the Home Contest

      For the Home Contest
    • Big and Small Contest

      Big and Small Contest



    2 years ago

    File "", line 1
    Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:20:19) [MSC v.1925 32 bit (Intel)] on win32
    SyntaxError: invalid syntax


    Reply 1 year ago

    start a new file and only copy and paste from "import praw" down


    1 year ago

    I can't do it because of the CMD redirect. it always loops the same code and cd loops the same directory. i can't


    3 years ago

    Step 6: Drag Praw.ini File Into FolderDrag, in windows, by default, MOVES the file. This is kind of dumb because the next time you wanted to use the ini file its gone from the location its meant to be. It should be explicitly stated to COPY the file.


    Reply 2 years ago

    ... right click on it and press open or edit its not gone you just need to open it correctly


    2 years ago

    I'm on chromebook and have to do this on Windows because I don't have a Mac of any sort


    Question 3 years ago

    Is there a way to exclude keywords and just reply to the top 'x' amount of posts?