How do I correctly shutdown a Bot::BasicBot bot (based on POE::Component::IRC)?
Posted
by rarbox
on Stack Overflow
See other posts from Stack Overflow
or by rarbox
Published on 2010-03-18T16:06:23Z
Indexed on
2010/03/18
16:11 UTC
Read the original article
Hit count: 447
This is a sample script. When I hit Ctrl+C, the bot quits IRC but it reconnects back after some time. How do I shut down the bot correctly?
#!/usr/bin/perl
package main;
my $bot = Perlbot->new (server => 'irc.dal.net');
$SIG{'INT'} = 'Handler';
$SIG{'TERM'} = 'Handler';
sub Handler {
print "\nShutting down bot...\n";
$bot->shutdown('Killed.');
};
$bot->run;
package Perlbot;
use base qw(Bot::BasicBot);
sub connected {
my $self = shift;
$self->join('#codetestchan');
}
© Stack Overflow or respective owner