David Grace

Bay Area, California

Programmer, SysAdmin, Artist

Silly Twitter Bot Tricks

A few of my friends have Twitter horse_ebook style accounts. If you’re not familiar with this, well, it has a Wikipedia entry these days! In short, it’s a semi-famous (in a meme-ish way) bot which posted snippets from Ebooks in an attempt to avoid spam detection on Twitter. It mixed up the sentences of the books in a way that generated a lot of unintentionally funny non sequiturs.

Back to Twitter – My friends have their own versions of this account, and most use something like Mispy’s twitter_ebooks Ruby program. It’s a fun and silly thing to do, and I wanted join in.

Using a pre-existing program would have been convenient and easy, but I wanted to make my own! And so I did. I decided to use Node.js, because it’s always handy to keep my Javascript skills honed and sharp. I’ve used Node.js successfully, along with the Grunt task management library, to build back end systems for processing data or web pages. So it’s a natural choice for me.

The process is simple: Acquire Twitter timeline, and then process it into a Markov chain. Then walk this Markov chain to generate a new Tweet, and post that. Do so on a schedule, so the program can be triggered and run unattended.

The source code for Malkavianizer

Nothing too exciting, but I did learn a bit about writing unit tests using Mocha. My previous projects used my own simple testing suite.