#!/usr/bin/perl # AIM bot to annoy the hell out of everyone at work # Bot will sit on AIM, and if you message it, it will relay the message # to the group you specify. use Net::AIM; use strict; my @grouptech = ("ScreenName1","ScreenName2"); my @groupweb = ("ScreenName1","ScreenName2"); my $aim = new Net::AIM; $aim->debug(0); $aim->newconn(Screenname => 'yoursn', Password => 'yourpass') or die "Can't connect to AIM server.\n"; my $conn = $aim->getconn(); $conn->set_handler('im_in', \&on_im); sub on_im { my ($self, $event) = @_; my ($sender, $away, $msg) = @{$event->args()}; $msg =~ s/<[^>]+>//g; $msg =~ s/^\s+//g; if ($msg =~ /^tech:.*/) { $msg =~ s/^tech://g; print "Msg: <" . $sender . "\@tech> " . $msg . "\n"; $msg="<" . $sender . "\@tech> " . $msg; foreach my $recip (@grouptech) { $aim->send_im($recip,$msg); } } elsif ($msg =~ /^web:.*/) { $msg =~ s/^web://g; print "Msg: <" . $sender . "\@web> " . $msg . "\n"; $msg="<" . $sender . "\@web> " . $msg; foreach my $recip (@groupweb) { $aim->send_im($recip,$msg); } } else { $aim->send_im($sender,"Error: You must preface your message with a group name, followed by a colon! Available groups are: tech, web"); } } $aim->start();