Basic IRC Twitter bot

On #quakelive on QuakeNet, there was a bot named QLTwitter that spits out text everytime the QUAKE LIVE Twitter account updated. I've gotten a few requests for the code, so figure I'd publicly release it.

It has a couple of dependencies, all of which are available in Debian packages. Specifically, it requires POE, its IRC client module, and JSON modules. It is basic, but it works, and can easily be changed to broadcast tweets from any other account.

use warnings;
use strict;

use POE;
use POE::Component::IRC;
use JSON;
use LWP::Simple;
use Time::HiRes qw(time);

my ($irc) = POE::Component::IRC->spawn();
my $currStatus = '';
my $updateDelay = 120;
sub CHANNEL { "#quakelive" }

    inline_states => {
       _start     => \&bot_start,
       irc_001    => \&on_connect,
       tick       => \&checkTweet

sub bot_start {
    $irc->call(register => "all");
    $irc->call(connect =>
          { Nick => 'QLTwitter',
            Username => 'QLTwitter',
            Ircname  => 'QLTwitterBot by sponge',
            Server   => 'us.quakenet.org',
            Port     => '6667',

sub on_connect {
  $irc->call(privmsg => 'Q@CServe.quakenet.org', 'AUTH sponge ------');
  $irc->call(join => CHANNEL);
  $irc->call(privmsg => CHANNEL, 'QLTwitterBot is LARGE and IN CHARGE!');
  $_[KERNEL]->delay( tick => $updateDelay);

sub checkTweet {
  eval {
    my $json = get 'http://twitter.com/statuses/user_timeline/quakelive.json';
    my @statuses = from_json($json);
    my $curr = $statuses[0][0]->{'text'};
    if ($currStatus ne $curr) {
      $irc->call(privmsg => CHANNEL, "New QUAKE LIVE Twitter update: $curr");
      $currStatus = $curr;
  eval { $_[KERNEL]->delay( tick => $updateDelay); }

exit 0;

It's old, not exactly pretty (what Perl is?) but maybe someone will find a use for it!