Swordkeeper has asked for the wisdom of the Perl Monks concerning the following question:
I was thinking of doing it this way, to have it idle on a chan..here is my version#!/usr/bin/perl use IO::Socket; $s = IO::Socket::INET->new(Proto=>'tcp',PeerAddr=> 'irc.cyberarmy.com' +,PeerPort=> 6667); print $s "NICK b0t\nUSER b0t - - :b0t\n"; while($s) { my ($i,$j)= split/ /, $_ = <$s>; print; if ($_ eq 'PING') +{ print $s 'PONG '.$j;} }
I havent had the time to really get into this, but it should work, based on what I can see from the IRC rfc (rfc 1459 if your interested), and would be interesting, since you could then run it from a server such as a free webhost that let you do cgi.. great in times nickserv or chanserv is offline, if it was alreaady idling with ops - then no-one could take over the chan from lack of chanserv or nickserv if no one was there.. has anybody has a simaler idea? I searched for something like this on perl monks, but I didnt find anything.. anybody got some ideas?#!/usr/bin/perl use IO::Socket; #IO through sockets..;) $s = IO::Socket::INET->new(Proto=>'tcp',PeerAddr=> 'irc.dal.net',PeerP +ort=> 6667); #set up the server and info for the bot. print $s "NICK WhiteRav3n0wnz\nUSER b0t - - :b0t\n"; #Bot info to server. print $s "JOIN #hackerhost\n"; #Chan to enter. while($s){ #main bot loop my ($i,$j)= split/ /, $_ = <$s>; #split incomming text print; if ($_ eq 'PING') { #if you get a ping from the server, print $s 'PONG '.$j; #pong back.. } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: IRC bot in perl
by gellyfish (Monsignor) on Mar 10, 2002 at 09:33 UTC | |
by Swordkeeper (Novice) on Mar 10, 2002 at 10:20 UTC | |
by gellyfish (Monsignor) on Mar 10, 2002 at 10:58 UTC | |
|
Re: IRC bot in perl
by Juerd (Abbot) on Mar 10, 2002 at 12:39 UTC | |
by Swordkeeper (Novice) on Mar 15, 2002 at 08:12 UTC |