Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I correctly shutdown a Bot::BasicBot bot (based on POE::Component::IRC)?

Tags:

perl

bots

irc

poe

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');
}
like image 298
rarbox Avatar asked Apr 08 '26 07:04

rarbox


1 Answers

I've taken over maintainership of Bot::BasicBot, and as of version 0.82, you can shut it down properly with $bot->shutdown($quit_message).

like image 119
Hinrik Avatar answered Apr 11 '26 00:04

Hinrik



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!