Pile of Turtles Archive

Showbot

7/12/2011
Header Image

Showbot was born out of love for the wonderful 5by5 podcasting network. Specifically, I created Showbot during the live recording of Back to Work, S1E17. Apropos, considering Back to Work is a podcast about being productive. Showbot started as an IRC bot to answer commonly asked questions in the 5by5 chat room, and has evolved to handle parsing iCal data from 5by5′s calendar, scraping the live Shoutcast stream for metadata, mirroring show title suggestions from IRC onto a website, and much more.

From 0 to Bot in 45 Minutes

I was spurred to create Showbot by fellow 5by5 chat denizen, Kim Roen, who said something to the effect of, “Someone should really make an IRC bot that answers the common questions that people have.”

Showbot would not exist if not for Cinch, a Ruby IRC bot framework rivaling Sinatra in simplicity. I was able to go from concept to functional bot within 45 minutes. Getting Real’s philosophy of making the bare minimum product and shipping it is exactly what I needed. If I hadn’t been able to create a working bot within the first few minutes of messing around with Cinch, I would’ve assumed IRC bots were too complicated to make for fun. Those first 45 minutes of work on Showbot have lead to many more weeks of development, during which I churned out a mature product.

Flooding, What’s That?

Showbot became popular quickly. With popularity came slowdowns, vast slowdowns. The sluggishness actually became so bad that Dan Benjamin (the creator of the 5by5 network) and John Siracusa poked fun at it during a show. It turns out that the amount of messages anyone connected to IRC (even a bot) can send is limited for the entire IRC server. When you pass this limit, you’re flooding.

Cinch throttles the messages the bot sends to keep from being kicked from the IRC server due to excess flooding. The main culprit was the !suggestions command, which returned the list of show title suggestions from the last few hours. During a live taping it’s not uncommon to see more than 60 suggestions, which means Showbot was sending 60 messages for each user that requested the list. The throttling caused messages to arrive minutes later from when commands were issued. A more complex solution was necessary.

Hosting

Showbot had outgrown IRC. I talked with Dominik, the creator of Cinch, and he agreed that IRC simply wasn’t designed for the volume of messages Showbot wanted to send. Showbot needed a website to display title suggestions. Showbot also had to be rewritten to allow these suggestions to be accessed by the web process. In the mean time, Showbot had also outgrown my flakey home network connection.

I first decided to go with Heroku, because it was dead simple to setup. However, I found out the limitations of the free plan on Heroku caused the web service to be unloaded, and then reloaded once someone visited the website later. This caused Showbot to disconnect from IRC until someone visited the website again, not good. These disconnects were my fault, because I decided to tightly couple the website and IRC bot. Showbot needed to be rewritten, again.

2.0

For Showbot 2.0 I rewrote everything. Title suggestions now get stored in a database. The web process runs separately and accesses the database. MVC never seemed so stupid obvious. That’s a lesson I’ll never need to learn again. Now Showbot needed somewhere to live, and it was clear that I couldn’t do this for free. I had grand visions of pushing the suggestions into a Gist to achieve free hosting, but I realized that I was being a cheapskate.

showbot.me

I bought a domain name, now it was time to serious. Next, I needed a host. I compared many hosting providers and decided on Linode based on this awesome VPS comparison article. And it turned out they were right, Linode is fucking awesome. With everything in place I launched showbot.me and crossed my fingers.

Reception

Dan Benjamin and Merlin Mann were the first to experience showbot.me. I got lucky and their reactions were broadcast live. Hearing this is what every programmer hopes to have happen when someone uses something they create. I was blown away by the warm reception I got by the 5by5 broadcasters and community. It is hard to convey in words how meaningful it is to have something you created be used and loved.

Needless to say, I’m going to keep working on Showbot, adding more features and polish. Showbot is open source and is hosted on GitHub. Thanks to Dan Benjamin for building 5by5 and managing to find the best show hosts seen on any tech podcasting network. And of course, thanks to the awesome 5by5 community.

Category: Development
Tags: code, showbot
by @mutewinter