A Twitter Bot in 10 Lines

Everyone loves Robocop right? He's a police officer and a robot, it's the greatest pairing since PB+J. Plus he has an affection for Unicorns.

Robocop, Unicorn

We can learn a lot from Robocop. I mean, just check out the Wikipedia entry:

Set in a crime-ridden Detroit, Michigan in the near future, RoboCop centers on a police officer who is murdered brutally and subsequently re-created as a super-human cyborg known as "RoboCop". RoboCop includes larger themes regarding the media, gentrification and human nature in addition to being an action film.

Having watched the movie 100 times during my teen years, I can assert that it definitely has all those larger themes covered. I eagerly away the Criterion Collection DVD. Robocop spawned sequels, a stage adaptation, and also a musical.

One of the best catchlines from Robocop is "I'd buy that for a dollar". From Wikipedia:

A joke among people who know RoboCop is a popular, but inane TV show with the catchphrase "I'd buy that for a dollar!", which people in the film's future universe find humorous. The star is the goofy Bixby Snyder (S.D. Nemeth). Neither the name of the show nor the character are ever revealed in the movie, although girls are heard to greet him with "Bixby!" and "Happy birthday Dave!" On the DVD commentary, Edward Neumeier comments that somehow the explanation & history of this television show was never included in the script. A deleted scene from the DVD finally reveals the show's name to be It's Not My Problem!, which is also a reference to one of the film's major themes of greed and personal satisfaction.

Allow me to introduce Bixby Snyder to Twitter. Thanks to a nifty ruby gem Twibot, anyone who mentions Robocop in a tweet will get a taste of nostalgia in return. Here's the source code if someone wants to play:

require 'rubygems'
require 'twibot'

# Receive messages, and tweet them publicly
search "robocop", :lang => "en" do |message, params|
  tmp = client.status :get, message.id
  post_reply tmp, "I'd buy that for a dollar!"

You learn two things while writing a Robocop-based twitter bot:

1 - People talk about Robocop a lot more than you think on Twitter. And I don't mean the Kanye West song.
2 - Writing bots is really fun.

Filed under: Code, robocop, twitter