Skip to content

Commit 15e1e4e

Browse files
committedDec 18, 2014
Fix bits to connect on IRC
1 parent bd3b36b commit 15e1e4e

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed
 

‎lib/App/LolBot/Bot.pm

+6-7
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ sub run {
7777
my $self = shift;
7878
my $leet = 0;
7979
my $random = 0;
80-
8180
print "*** LolBot initialization... ***\n";
8281

8382
$self->connect();
@@ -89,23 +88,23 @@ sub run {
8988

9089
while(my ($prefix, $cmd, @args) = $self->server->recv()){
9190

91+
#Answer to the ping of the server to stay connected
92+
$self->server->send("PONG", ($args[@args-1])) if ($cmd eq "PING");
93+
9294
#Identify the bot on the server
93-
if ($cmd eq "NOTICE" && $args[0] eq "AUTH"){
95+
if ($cmd eq "NOTICE" && $args[0] =~ m/(Auth)/i){
9496

9597
print "Identifying itself on the server...\n";
9698

9799
$self->server->send("NICK", $self->nickname);
98-
$self->server->send("USER", ($self->nickname, $self->nickname, $self->host, ":" . $self->nickname));
100+
$self->server->send("USER", ($self->nickname, $self->nickname, $self->host, ":" . $self->nickname));
99101
}
100102

101103
if ($cmd eq "376"){
102104
print "Joining channel " . $self->chan . "...\n";
103105
$self->server->send("JOIN", ($self->chan));
104106
}
105-
106-
#Answer to the ping of the server to stay connected
107-
$self->server->send("PONG", ($args[@args-1])) if ($cmd eq "PING");
108-
107+
109108
#Deal with new nicknames
110109
$self->stats->init_nick_list(@args) if ($cmd eq "353");
111110
$self->stats->new_join($prefix) if ($cmd eq "JOIN");

‎lib/App/LolBot/Server.pm

+2-2
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ sub send {
8383
my ($cmd,@args) = @_;
8484

8585
my $socket = $self->socket;
86-
87-
$cmd = join(" ",$cmd,@args,"\r\n");
86+
$cmd = join(" ",$cmd,@args);
87+
$cmd = join("",$cmd,"\r\n");
8888
print $socket $cmd;
8989
print $cmd;
9090
}

0 commit comments

Comments
 (0)