in Hacks

A new bot on block: BaddieBot & Updates

Let’s start with the updates. Yesterday, I announced that I will publish more projects on github. The first one is the norepost bot for Reddit (blog post):

Norepost bot for Reddit (on github)

This bot crawls the /new page of a subreddit to detect reposts. It uses special filtering for youtube links otherwise it searches if the same URL was submitted before.

The second one is the mlg soundboard (blog post):

MLG Soundboard using Web Audio API (on github)

This features a simple soundboard using Web Sound API and distortion effects.

Let’s go to the main feature: BaddieBot

BaddieBot what?

Yesterday, I saw a request in /r/RequestABot about a bot which posts other submissions by the same user and allows people to subscribe to other user’s submissions. This was quite interesting though the author mentioned an other bot who does the same. So I looked up the bot’s source code just for interest and found a github repository which could be related to the bot. It was written in Java. Somehow, I don’t know exactly why, I thought: “Maybe I should rewrite it in Python because I like Python and it would be fun“.

Using old source code

The two main requirements for the bot were:


  1. Post a comment to every post linking the OP’s past submissions to /r/badpeoplestories
  2. Allow users to subscribe for a pm on Reddit when a certain user posts a new story in /r/badpeoplestories (via a link in the comment showing past submissions)


The first point was easily done because my other bot does a similar thing. I knew that I can use reddit’s search to find other people’s submissions. I looked up modifiers and saw that there’s an “author:” modifier.

I copied my other bot and started deleting stuff I longer needed. Edited the search parameters and the first step and changed the message it should post. Done.

The second point was a bit more interesting. I expanded my database to add subscribers, added a loop looking for new messages and parsing them and added a unsubscribe function. While doing this I felt like all the time I worked on bots or scrapers in the past just combined into the moment and I knew exactly what I should do and what I should expect. It was fantastic.

I tested it a bit and messaged the requester. He quickly created an account and it tested it again. So far, it works fine and the best thing is I took me less than 2 hours from start to finish – including testing.

The source code is online on Github: BaddieBot for Reddit

Write a Comment


This site uses Akismet to reduce spam. Learn how your comment data is processed.