This script requires python 3, praw, and praw-oauth2util.
To install praw type in your command line:
pip install praw
pip install praw-oauth2util
- Go here on the account you want the bot to run on
- Click on create a new app.
- Give it a name.
- Select script from the radio buttons.
- Set the redirect uri to
http://127.0.0.1:65010/authorize_callback
- After you create it you will be able to access the app key and secret.
- The app key is found here. Add this to the app_key variable in the oauth.txt file.
- And the app secret here. Add this to the app_secret variable in the oauth.txt file.
Note: On the first run of the bot you'll need to run it on a system that has a desktop environment. So, if you're planning on running the bot on a server or VPS somewhere, run it on your computer first. The first run will require you to authenticate it with the associated Reddit account by opening a web page that looks like this:
It will list different things it's allowed to do depending on the bots scope. After you authenticate it, that page won't pop up again unless you change the OAuth credentials. And you'll be free to run it on whatever environment you choose.
Set the SUBREDDIT_NAME variable to the name of the subreddit, don't include the /r/.