@@ -77,7 +77,6 @@ sub run {
77
77
my $self = shift ;
78
78
my $leet = 0;
79
79
my $random = 0;
80
-
81
80
print " *** LolBot initialization... ***\n " ;
82
81
83
82
$self -> connect ();
@@ -89,23 +88,23 @@ sub run {
89
88
90
89
while (my ($prefix , $cmd , @args ) = $self -> server-> recv ()){
91
90
91
+ # Answer to the ping of the server to stay connected
92
+ $self -> server-> send (" PONG" , ($args [@args -1])) if ($cmd eq " PING" );
93
+
92
94
# 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 ){
94
96
95
97
print " Identifying itself on the server...\n " ;
96
98
97
99
$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));
99
101
}
100
102
101
103
if ($cmd eq " 376" ){
102
104
print " Joining channel " . $self -> chan . " ...\n " ;
103
105
$self -> server-> send (" JOIN" , ($self -> chan));
104
106
}
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
+
109
108
# Deal with new nicknames
110
109
$self -> stats-> init_nick_list(@args ) if ($cmd eq " 353" );
111
110
$self -> stats-> new_join($prefix ) if ($cmd eq " JOIN" );
0 commit comments