#!/usr/bin/perl # bot irc minimaliste use strict; use warnings; use IO::Socket; my $server = "irc.mindforge.org"; my $nick = "leblerot"; my $username = "bot"; my $realname = ":Perl IRC bot"; my $host = "kgentoo.homenet"; my $sock = new IO::Socket::INET(PeerAddr => $server, PeerPort => 6667, Proto => 'tcp') or die "Can't connect\n"; # Auth print $sock "NICK $nick\r\n"; print $sock "USER $username $host $server $realname\r\n"; # Joining channels print $sock "JOIN #keikoz\r\n"; print $sock "JOIN #linux-fr\r\n"; # Listening for messages while (my $input = <$sock>) { chop $input; print "$input\n"; # PING answer if ($input =~ /^PING\s(.*)$/) { print $sock "PONG $1\r\n"; } }