#!/usr/bin/perl
use Net::IRC;
my $irc = new Net::IRC;
my $conn = $irc->newconn(
Server => 'irc.psigenix.net',
Port => '6667',
Nick => 'Guardian',
Ircname => 'Guardian v1.02',
Username => 'XGuard'
);
$conn->{channel} = '#KefkasTower';
sub on_connect {
my $conn = shift;
$conn->privmsg(NickServ, 'IDENTIFY **************');
$conn->join($conn->{channel});
$conn->{connected} = 1;
}
$conn->add_handler('376', \&on_connect);
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 !roker
if ($text =~ /^\!rejointest/) {
$conn->part($conn->{channel});
$conn->join($conn->{channel});
}
}
$conn->add_handler('public', \&on_public);
$irc->start();