本文介绍了如何正确关闭Bot :: BasicBot机器人(基于POE :: Component :: IRC)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是一个示例脚本.当我按Ctrl + C组合键时,该漫游器退出了IRC,但过了一段时间它又重新连接了起来.如何正确关闭漫游器?
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');
}
推荐答案
我已经接管了Bot :: BasicBot的维护,从0.82版开始,您可以使用$bot->shutdown($quit_message)
将其正确关闭.
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)
.
这篇关于如何正确关闭Bot :: BasicBot机器人(基于POE :: Component :: IRC)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!