Tea commented on a Page, Perl IRC bot  -  Jul 07, 2009

Also you could do this:-

!/usr/bin/perl

use IO::Socket;
use warnings;
use strict;

$sock = IO::Socket::INET->new(
PeerAddr => 'server_here',
PeerPort => 6667,
Proto => 'tcp' ) or die "could not make the connection";

while($line = <$sock>){
print $line;
if($line =~ /(NOTICE AUTH).*(checking ident)/i){
print $sock "NICK nick_here\nHelpBot :just a bot\n";
last;
}
}

while($line = <$sock>){
print $line;

use next line if the server asks for a ping

if($line =~ /^PING/){
    print $sock "PONG :" . (split(/ :/, $line))[1];
}
if($line =~ /(376|422)/i){
    print $sock "NICKSERV :identify nick_password\n";
    last;
}

}

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.