pong fix for freenode
This commit is contained in:
parent
a3f5795ef3
commit
a5267b8cdd
|
@ -1,4 +1,6 @@
|
|||
server = irc.synirc.org
|
||||
#server = irc.synirc.org
|
||||
server = irc.freenode.org
|
||||
#server = irc.undernet.org
|
||||
port = 6667
|
||||
nick = buttbottest
|
||||
ident = null
|
||||
|
|
11
buttbot.pl
11
buttbot.pl
|
@ -69,6 +69,12 @@ sub process {
|
|||
process_line($_) for split /\n/, gets();
|
||||
}
|
||||
|
||||
sub cmd_pong {
|
||||
my $command = shift @_;
|
||||
$command =~ s/^://;
|
||||
pong($command =~ /^\d+$/ ? $command : "$CONF{nick} $command")
|
||||
}
|
||||
|
||||
sub process_line {
|
||||
my $line = shift;
|
||||
print "$line\n";
|
||||
|
@ -81,7 +87,10 @@ sub process_line {
|
|||
die "from server: @data" if $from eq 'ERROR';
|
||||
|
||||
# if server pings, ping back.
|
||||
pong($command =~ /^:\d+$/ ? $command : ":$CONF{nick}") if $from eq 'PING';
|
||||
|
||||
if ($from eq 'PING') {
|
||||
cmd_pong($command);
|
||||
}
|
||||
|
||||
# If buttbot has successfully connected to the server, join a channel.
|
||||
if ($command eq '001') {
|
||||
|
|
Loading…
Reference in New Issue