|
1 | 1 | # frcbot
|
2 |
| -A Reddit bot to help out around the /r/FRC sub |
| 2 | +A Reddit bot to help out around the /r/FRC sub. It's hastily-thrown together and not nearly feature-complete, but it works for now. |
| 3 | + |
| 4 | +##Requirement |
| 5 | +- Python 2 |
| 6 | + |
| 7 | +##Setup |
| 8 | +NOTE: This was developed and tested on a Linux (Debian) machine. YMMV with other distros/platforms. I also did not test these instructions from scratch. If anything is wrong, please submit a PR. If anything is horribly wrong, please head to your designated fallout bunker. |
| 9 | + |
| 10 | +1. Clone this repo |
| 11 | +2. Run `pip install -r requirements.txt` |
| 12 | +3. Sign up for a [new Reddit account](https://www.reddit.com/login) for your bot (highly recommended) |
| 13 | +4. Create and populate the `settings.cfg` file (see below) |
| 14 | +5. Create a [Reddit developer app](https://www.reddit.com/prefs/apps/) and copy the values into a new `oauth.ini` file |
| 15 | + |
| 16 | +##Configuration |
| 17 | +####settings.cfg |
| 18 | +The settings and values should look like these (substituting your own actual values) |
| 19 | +```ini |
| 20 | +[Reddit] |
| 21 | +subreddit=frctest |
| 22 | +useragent=platform:botname:v0.0.0 (by /u/username) |
| 23 | + |
| 24 | +[TBA] |
| 25 | +appid=username:botname:0.0.0 |
| 26 | +``` |
| 27 | + |
| 28 | +####oauth.ini |
| 29 | +Fill in your Reddit application key and secret that you created earlier. Leave everything else as-is. |
| 30 | +```ini |
| 31 | +[app] |
| 32 | +scope = edit,identity,modposts,read,submit |
| 33 | +refreshable = True |
| 34 | +app_key = YOUR_KEY_HERE |
| 35 | +app_secret = YOUR_SECRET_HERE |
| 36 | + |
| 37 | +[server] |
| 38 | +server_mode = True |
| 39 | +url = 127.0.0.1 |
| 40 | +port = 65010 |
| 41 | +redirect_path = authorize_callback |
| 42 | +link_path = oauth |
| 43 | +``` |
| 44 | + |
| 45 | +##Usage |
| 46 | +Edit the script to change the title's week number. This behavior will change later. Then run `python weekly_discussion.py`. Keep in mind that the script only takes a few minutes at most to run and may require some input/interaction, so I would suggest **not** running it as a cron job or in the background for now. |
| 47 | + |
| 48 | +On your first run, you will need to authenticate with Reddit OAuth by logging in to a URL printed in the console. It's a localhost address, so you'll need to perform this on the server. I used Debian's built-in **w3m** terminal browser (`w3m http://127.0.0.1/oauth`), other distros may have something similar. Once PRAW 4 is released, this should be a lot easier to configure. |
| 49 | + |
| 50 | +Also, if your bot account is brand-spankin' new and/or does not have a verified email address, you will get hit with CAPTCHA requests everytime it attempts to post. The console will print out a URL that you need to visit (this can be from any computer) that has the image. Type the letters into the console and hit <Enter> and the script will continue as planned. |
0 commit comments