Git Product home page Git Product logo

reddit-local-bot's Introduction

Reddit Bot Tutorial

About

This repository contains the code required to build a Reddit bot according to the tutorial made by shantnu, which can be found here

Shantnu's github for the tutorial can be found here

A few significant modifications have been made to the base tutorial in bot_read.py (Part 1) and marvin_the_depressed_bot.py (Part 4). In bot_read.py, the subreddit and filter is determined by user input rather than hard-coded and the output has been cleaned up for readability. In marvin_the_depressed_bot.py, Marvin's quotes have been moved to a separate text file which is called within the code and a break condition has been applied so that the program does not run forever without KeyInterrupt.

To run, install praw first:

$ pip install praw

Create a reddit bot and add the bot's client_id, client_secret, username, password, and user_agent to praw.ini, which are currently left blank for security reasons.

Then, run bot_read.py, which demonstrates the first part of the tutorial, to view the five latest submissions in the user's choice of subreddit and filter of . The program will prompt the user to provide the name of the subreddit and the filter (hot, new, controversial, top) :

$ python bot_read.py

reply_post.py demonstrates the second part of the tutorial searches r/PythonforEngineers (created by shantnu) for submissions with "I love Python" in their title and replies "Good for you!" To run:

$ python reply_post.py

marvin_the_depressed_bot.py demonstrates the final part of the tutorial. Quotes taken from IMDB are randomly selected and used as replies to any submission in r/PythonforEngineers that includes "Marvin help". The program will terminate after 5 requests that return no new instances of "Marvin help". To run:

$ python marvin_the_depressed_bot.py

reddit-local-bot's People

Contributors

megcrow 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.