mattabullock / Baseball-GDT-Bot

A Reddit bot that will generate, post, and keep baseball game discussion threads updated with live stats and scores.
13 stars 14 forks source link

Baseball GDT Bot

Current Version: 4.0.0

The point of this project is to create a bot that will generate a game discussion thread that contains live linescore and boxscore, post it in the correct subreddit for that team, and keep it updated throughout the game.

Version 1.0 was written in a mix of Python and Java, and has been completely ported to Python for v2.0 and v3.0 (this version).


Set Up OAuth

Go to reddit.com’s app page, click on the “are you a developer? create an app” button. Fill out the name, description and about url. Name must be filled out, but the rest doesn’t. Write whatever you please. For redirect uri set it to http://127.0.0.1:8080. All four variables can be changed later.

Copy sample_settings.json to the src folder and rename it to settings.json. Fill in the CLIENT_ID, CLIENT_SECRET, and REDIRECT_URI fields in the settings.json file and save.

Run the script. Your browser will open. Click allow on the displayed web page.

Enter the code from the URL into the console and the access information will be printed. This includes the final bit of info you need, the refresh token.

Fill in the REFRESH_TOKEN field in the settings.json file and save.

Configuration

To use the default settings, copy sample_settings.json into src/settings.json.

Descriptions of Settings


If something doesn't seem right, feel free to message me or post it as a bug here.

This was written in Python 2.7, so beware if you are running Python 3 or above that it may not work correctly. Also make sure you install praw and simplejson before running!

Modules being used:

praw v5.0.1 - interfacing reddit
simplejson - JSON parsing
urllib2 - pulling data from MLB servers
ElementTree - XML parsing

Updates

v4.0.0

v3.1.0

v3.0.2

v3.0.1

v3.0.0

v2.0.4

v2.0.3

v2.0.2

v2.0.1