Twitter Bots I’ve Made

I’ve made a few twitter bots over the years. Some were good ideas, and some were bad ideas. I used them as opportunities to learn some python and ruby. I like bots! They take a day or two to setup, and then you just let them go.

Twitter is pretty strict about bots. When I create new ones, the account always gets banned 2 to 3 times BEFORE the bot has even tweeted once. Crazy, huh? Most of my bots are totally benign, but a few were annoying and rightfully banned (or disabled by me).

I think I have like 12 twitter accounts right now. This is from someone who spends at most 2 minutes on Twitter per day. I can’t stand the site! But it’s a good medium for futzing around with bots.

@lacrashbot

I processed all the collisions in Los Angeles County for a year, and then this bot tweeted out some details of each crash in real time (one year later). “Processing” involved converting the various codes in the collision reports into plain language that can be strung together into sentences.

I might modify it in the future, so it tweets a little less often. It tweeted like 20k times in one year! I thought this was a cool idea. It was a lot of work (at the time) to setup, and thus I didn’t continue it for subsequent years. I’m sure I could implement it in a much simpler way next time.

I used python for this. Code is here on Github. I hosted it on a raspberry pi at my house.

@pinballmapcom

I modified this python twitterbot script for this one. Previously we were using IFTTT to check Pinball Map’s RSS feed and tweet new feed items. But then IFTTT unexpectedly imposed 25-per-day limit on this service, with no option to pay and upgrade (hello!). So this replaces IFTTT. It’s working great! It’s hosted on a friend’s server.

@softpoofs

This one was a bad idea. I wanted to make a grammar bot. And I made the mistake of venturing into the world of partisan politics. This bots corrects people when they use the phrase “Democrat Party” instead of “Democratic Party.” The developer access for this bot was blocked a couple times. Each time I took that opportunity to better understand Twitter’s rules (such as, “bots can’t reply to people that don’t follow you”). Plus, the rules changed over time. This bot did adhere to all the rules, but was banned anyway. For the best!

I even made it so that the bot replies if people reply to it. But, I made it so the replies attempt to diffuse any animosity (with things like, “you’re right!”).

This bot used the ruby chatterbot and tracery gems. Tracery is a json format for randomizing and stringing together phrases. With it, you can create many variants of sentences. For example, you can start off your phrase with “segment_01” which contains “hi”, “hello”, “yo”. It will randomly choose one of those, and then “segment_02” can have options for the next part of the phrase (“how are you?” “what is up?” “how’s it going” etc). And then each time the script runs, it will generate a fairly unique phrase! It’s fun to play with.

This was hosted at my home on a raspberry pi. The ran periodically with a cron job.

@drunkenwhoops

This was another bad idea. I am an urban planner who specializes in safety and transportation, and it stands out to me when newspapers (and individuals) refer to crashes as “accidents.” There is a “crash not collision” movement that attempts to educate people and change the standards that journalists have.

However, after a couple of days I realized that this bot was in very bad taste, because some of the tweets were from victims of drunk driving collisions. And it was very bad for the bot to reply to them.

This also used ruby, chatterbot, and tracery, and was hosted on my pi.

@isjesusreturned

This one is still going strong (since November 2018)! This bot tweets once a day at 8:15am PST. It tells you whether Jesus has returned to Earth. So basically, it tweets some variety of, “he’s not back yet!”

It uses ruby, chatterbot, tracery. With Tracery, it has a fair amount of variety to what it says each day. I occasionally add to it.

I think this is a pretty good bot. It’s simple. It’s not harmful.

@oddpinballmap

This is another bot for Pinball Map. I wrote this myself in Ruby, as a way to learn more stuff. It tweets a random Pinball Map location every couple of hours. Each tweet includes some details, like the type of business, and a (partial) list of machines.

It uses the Pinball Map API to get the total number of location IDs, then it picks a random one, and then queries that ID for some details. I think I did a good job with this one! There isn’t much of a target audience for it, though.

Leave a Reply

Your email address will not be published. Required fields are marked *

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