Advertisement
Guest User

Untitled

a guest
Jan 18th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. #!/usr/bin/perl
  2.  
  3. use strict;
  4. use warnings;
  5.  
  6. use IO::Socket;
  7. use Term::ANSIColor;
  8.  
  9. my $Bleu = "\00302";
  10. my $Norm = "\017";
  11. my $Vert = "\00303";
  12. my $Rouge = "\00304";
  13. my $Jaune = "\00307";
  14.  
  15. my $con = IO::Socket::INET->new(PeerAddr=>'localhost',
  16. PeerPort=>'6667',
  17. Proto=>'tcp',
  18. Timeout=>'30') || print "Error! $!\n";
  19.  
  20. print $con "USER Cacao Bot Bot :IrcBot\r\n";
  21. print $con "NICK Cacao\r\n";
  22. $SIG{INT} = \&quit;
  23. while(my $answer = <$con>)
  24. {
  25. print $answer; #Show server reply
  26. my @Data = split(/ /,$answer);
  27. $Data[0] =~ /^:(.*?)!/;
  28. my $Nick = $1;
  29. if($answer =~ /376/) {
  30. print "Connecté !\r\n";
  31. print $con "JOIN #SupremChoco\r\n";
  32. print $con "PART #Meteo\r\n";
  33. }
  34. if(($answer =~ /PRIVMSG/) && ($answer =~ /!choco/i)) #Regex to see if it was a message, way too simple so needs tweaking!
  35. {
  36. sleep 1;
  37. 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 :
  38. }
  39. if(($answer =~ /PRIVMSG/) && ($answer =~ /!aide/i)) {
  40. # print color 'red';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement