Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- use strict;
- use warnings;
- use IO::Socket;
- use Term::ANSIColor;
- my $Bleu = "\00302";
- my $Norm = "\017";
- my $Vert = "\00303";
- my $Rouge = "\00304";
- my $Jaune = "\00307";
- my $con = IO::Socket::INET->new(PeerAddr=>'localhost',
- PeerPort=>'6667',
- Proto=>'tcp',
- Timeout=>'30') || print "Error! $!\n";
- print $con "USER Cacao Bot Bot :IrcBot\r\n";
- print $con "NICK Cacao\r\n";
- $SIG{INT} = \&quit;
- while(my $answer = <$con>)
- {
- print $answer; #Show server reply
- my @Data = split(/ /,$answer);
- $Data[0] =~ /^:(.*?)!/;
- my $Nick = $1;
- if($answer =~ /376/) {
- print "Connecté !\r\n";
- print $con "JOIN #SupremChoco\r\n";
- print $con "PART #Meteo\r\n";
- }
- if(($answer =~ /PRIVMSG/) && ($answer =~ /!choco/i)) #Regex to see if it was a message, way too simple so needs tweaking!
- {
- sleep 1;
- print $con "PRIVMSG $Data[2] :Et un chocolat chaud pour $Nick 1 !\r\n"; #Reply to the message, don't forget about the space between #channel and :
- }
- if(($answer =~ /PRIVMSG/) && ($answer =~ /!aide/i)) {
- # print color 'red';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement