HW: Reddit Bot

Description: You will create a reddit bot that posts messages about your favorite (or least favorite) US presidential candidate.

Due: Sunday, 25 October / Tuesday, 3 Nov (see instructions below)

Learning objectives:

  1. understand how bots spread propaganda online
  2. integrate python programs with online social media
  3. write and deploy python daemons


  1. Download the bot.py file to you computer. This file contains 6 tasks. Complete each of these tasks.

  2. Once all of these tasks are complete, let your bot run continuously starting on 25 October and ending 3 Nov. It is okay to begin running your bot before 25 Nov.

  3. Create a github repo for this project. The repo should contain:

    1. your completed bot.py file (but not your praw.ini file!!!)
    2. a README.md file, properly formatted with markdown syntax, that:
      1. clearly states which candidate your bot is supporting or opposing.
      2. provides a link to your favorite thread involving your bot, an image screenshot of the thread, and a short description of what you like about it. (Below each comment is a button labeled permalink that lets you link to a comment.)
      3. includes the output of running the bot_counter.py file on your bot to count how many comments you've created; the output of this command must be inside of a markdown code block (i.e. use the triple backticks notation)
      4. explains what you believe your score should be (clearly state which tasks you complete/don't complete).

Grading rubric

The assignment is worth 20 points total.

  1. Each task in bot.py is worth 2 points. (6 tasks * 2 points/task = 12 points)

  2. The github repo is worth 2 points.

  3. Getting at least 100 valid comments posted is worth 2 points.

  4. Getting at least 500 valid comments posted is worth 2 points.

  5. Getting at least 1000 valid comments posted is worth 2 points.

Extra Credit

You earn 2 points of extra credit for each of the following tasks you complete.

  1. Make your bot create new submission posts instead of just new comments. You can easily automate this process by scanning the top posts in your favorite sub (e.g. /r/liberal or /r/conservative) and posting them to the class sub.

  2. Create an "army" of 5 bots that are all posting similar comments. This will require creating 5 different reddit accounts. You can use the same code for each bot (but different praw.ini files with the corresponding login credentials). The challenge is keeping all 5 of these bots running simultaneously. Each bot needs to post at least 100 comments to get this extra credit.

  3. Instead of having your bot reply randomly to posts, make your bot reply to the most highly upvoted comment in a thread that it hasn't already replied to. Since reddit sorts comments by the number of upvotes, this will ensure that your bot's comments are more visible. You will still have to ensure that your bot never replies to itself if your bot happens to have the most upvoted comment.

You earn 4 points of extra credit for each of the following tasks you complete.

  1. Use a more sophisticated algorithm for generating the text of your comments. There are good python interfaces to the GPT-2 text generation algorithm, like gpt-2-simple, but they can be a bit finicky to get working well. The Markovify library provides an easier to use algorithm that's better than the MadLibs algorithm from lab, but not as good as GPT-2. If you're interested in trying for this extra credit, I'd be happy to discuss how to do this in office hours.


Upload a link to your github repo to sakai.

WARNING: Don't underestimate the difficulty of this assignment and put it off until the last minute. Lots of surprising bugs always occur when your working on real world projects like this...