Coder Social home page Coder Social logo

drw-prospect-reddit-bot's Introduction

DRW Prospect Reddit Bot

This is a twitter subreddit bot written in Python. It currently adds all daily posts from DRWProspects twitter account into a single post to the Detroit Red Wings subreddit's daily discussion or game day thread post.

THIS PROJECT WILL NO LONGER BE UPDATED. SEE twitter-subreddit-bot

Getting Started

These instructions will get you a copy of the project up and running on your local machine for different purposes. See Use section for notes on how to use the bot.

Prerequisites

You will need to have Python 3.6+, PRAW, and python-twitter

***If you've just installed Python3, pip3 will be included but might not be up-to-date. Update it by running the command:

python3 -m pip install --upgrade pip

pip3 will now be updated to version 18.1 For more information or more help on using pip3, reference Using pip3 to install Python modules

Now install the necessary modules with the following commands:

pip3 install praw
pip3 install python-twitter

Installing

Clone or download the respository.

Use

In Terminal or Command Prompt, run the following command in the directory of the repo:

python3 bot.py

If the config.json file doesn't exist yet, it will be generated.

Replace each 'x' with the correct values to log into Reddit and Twitter, then run the previous command again. If everything was installed correctly, the program should state the correctly found Reddit thread, as well as list all of the tweets found, and then post the tweets found to the reddit thread.

This command/program will need to be ran again each time it is used.

Adjustment/Repurpose

The program is currently configured for the specific purpose of posting information about Detroit Red Wings prospects onto the r/DetroitRedWings subreddit daily post.

There are future plans to change adjustment options to config.json rather than hardcode, but this is currently not the case.

To use for another purpose, open bot.py in your favorite editor and edit the following:

Change the name of the subreddit:

subreddit = reddit.subreddit('DetroitRedWings')

Change the way the Reddit thread is found, unless you are looking for posts from a specific user within the top 2 Hot, in which case then you only need to change the name of the user:

for submission in subreddit.hot(limit=2):
		if (submission.author == "OctoMod"):
	 		print("Found submission titled: " + submission.title)

Change the Twitter user and the amount of tweets:

updates = twitterApi.GetUserTimeline(screen_name='DRWProspects', count=10)

Adjust the text added around the data pulled from the twitter updates:

message = ("Yesterday's Results:\n")
	for x in updates:
		d = datetime.strptime(x.created_at,'%a %b %d %H:%M:%S %z %Y');
		if (d.date() == datetime.today().date()):
			message = message + (str(x.full_text) + "\n\n").replace("#RedWings", " ")

	message = message + "I am a bot and this action was performed automatically. More information can be found at [My GitHub](https://github.com/randykinne/DRW-Prospect-Reddit-Bot)"
	message = message + "\n\nData Source: https://twitter.com/DRWProspects"

Contributing

Feel free to contribute. When submitting pull requests, include details on changes made.

Future Plans

  • Changing data source information from hardcode to config.json to make program more usable for a variety of purposes
  • Adding prompts for user confirmation for various events in the program to allow user to ensure that the bot is operating correctly

Examples

Check out u/DRWProspectBot on Reddit.

Authors

License

Licensed under the GNU General Public License v3.0.

drw-prospect-reddit-bot's People

Contributors

randykinne avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.