Maybe this will be a quick start. Look at the Net::IRC example at wholok.com (
http://www.wholok.com/irc/ ) and download the hello bot. Make sure its working ok, maybe testing it out on your own IRC server (i recommend
ngIRCd) or one that doesn't mind bots.
Then add a new on_public event to handle the `-event` messages that a channel might receive. Here's an example one for -count events:
Just add this somewhere above the $irc->start(); call.
Code:
sub on_public {
# on an event, we get connection object and event hash
my ($conn, $event) = @_;
# this is what was said in the event
my $text = $event->{args}[0];
# regex the text to see if it begins with -count
# then print the values
if ($text =~ /^\-count (\d+)\s(\d+)/) {
$conn->privmsg($event->{to}[0], "I received a count of $2 for server ID $1");
}
}
$conn->add_handler('public', \&on_public);
Fire up the bot and watch it go. So then just create additional if() statements to check the text for your commands and process as necessary.
I believe the roker bot on that page has an example of sending a private message to a user.
As for keeping track of stuff; you can keep counts of various things in memory (a hash works best), but you might want to occasionally write these values out to a file incase the bot needs to be restarted.
-r