Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

A simple IRCbot

by Amnesia-II (Scribe)
on Jun 26, 2004 at 12:37 UTC ( [id://369814]=CUFP: print w/replies, xml ) Need Help??

use IO::Socket; $server = 'irc.azzurra.it'; $port = '6667'; $channels = '#hack'; $nick = 'eXcelsior'; $username = "eXc \"\" \"\" :eXc"; $socket = IO::Socket::INET->new(PeerAddr => $server, PeerPort => $port, Proto => "tcp", Type => SOCK_STREAM); print $socket "user $username\n"; print $socket "nick $nick\n"; if ($linea =~/^PING/i){ $linea =~ s/^ping\s+://; print $socket "PONG :$linea \n";} print $socket "join $channels\n"; print $socket "privmsg $channels Salve \n"; while ($linea = <$socket>) { print "$linea \n"; if ($linea =~/^PING/i){ $linea =~ s/^ping\s+://; print $socket "PONG :$linea"; } if ($linea =~/!0/){print $socket "quit BYe\n";} if ($linea =~/!say/){ $linea =~s/!say //; @say =split(/\s+/,,$linea); print $socket "privmsg $channels @say[3]\n"; } if ($linea =~/!ban/){ $linea =~s/!ban //; @nick =split(/\s+/,,$linea); print $socket "mode $channels +b @nick[3]\n"; print $socket "kick $channels @nick[3]\n"; } if ($linea =~/!kick/){ $linea =~s/!kick //; @nick =split(/\s+/,,$linea); print $socket "kick $channels @nick[3]\n"; } }

Replies are listed 'Best First'.
Re: A simple IRCbot
by larsen (Parson) on Jun 26, 2004 at 12:47 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: CUFP [id://369814]
Approved by yosefm
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2025-06-24 04:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.