You fight like a dairy farmer! Some Twitter whimsy with Ruby
March 14, 2012 § 1 Comment
When I was a kid I used to love playing The Secret of Monkey Island. I played it on my Commodore Amiga 500 and it came on four 3.5″ floppy disks. Those were the days.
My favourite part of the game was the , where, instead of strength, a sharp wit was the only way to overcome your opponent. The insults range from derogatory (“You fight like a dairy farmer!”) to egotistical (“I got this scar on my face during a mighty struggle!”) and you take the lead character, Guybrush Threepwood, through a number of fights to learn them all.
Fast forward to today and with the power of Twitter and a few lines of Ruby we can recreate insult sword fighting for the modern world!
Inspiration
I was inspired to create a Twitter bot by a lightning talk from Corey Haines at RubyConf 2011. He described creating a that responds to people saying “good morning” (currently in 21 languages!). He created a gem called Tweetbot (no relation to the iOS app) based on top of the Twitter streaming API to make this easy for anyone. You don’t even need to host it anywhere as it works on Heroku.
With both the tools and the inspiration, all it took was finding a bit of time to implement my bot. Eventually, one Friday night, after an evening in the pub, when all ideas seem like good ones, I wrote . You can see the code on Github, just to show how easy it is to set up. The bot listens for any insult from the game and responds correctly to it.
Down to battle
Since writing the code and setting the bot free, the most fun has been watching people interact with it! From to . It’s also quite funny just to see how often the phrase “You fight like a dairy farmer” is tweeted!
It’s fun creating Twitter bots, and easy with the Tweetbot gem, so if you want to spread happiness like Corey’s bot, do battle like mine or anything else you can think of, get involved!
This is perhaps the best use of Twitter ever.