Advertisement
Guest User

Untitled

a guest
Jun 5th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 1.18 KB | None | 0 0
  1. #!/usr/local/bin/perl -w
  2.  
  3. use IO::Socket;
  4. ### INSERIMENTO DATI NELLE VARIABILI ###
  5. my $server = "irc.unitx.net";
  6. my $nick = "BotSenzascopo";
  7. my $user = "BotSenzascopo";
  8. my $pass = "tuamamma";
  9. my $login = "BotSenzascopo";
  10. my $channel = "#unit-x";
  11.  
  12. ### CONNESSIONE AL SERVER ###
  13.  
  14.  
  15. my $sock = new IO::Socket::INET(PeerAddr => $server,
  16.                                 PeerPort => 6667,
  17.                                 Proto => 'tcp') or
  18.                                     die "Non posso connettermi a $server\n";
  19.  
  20.  
  21. ### LOGIN ###
  22. print $sock "PASS $pass\r\n";
  23. print $sock "NICK $nick\r\n";
  24. print $sock "USER $login 8 * :$nick\r\n";
  25.  
  26.  
  27.  
  28. print $sock "MODE $channel +m $nick\n";
  29.  
  30. print $sock "JOIN $channel\r\n";
  31.  
  32. print $sock "PRIVMSG $channel :Ciao a tutti! ;)\r\n";
  33.  
  34.  
  35.  
  36. ### AZIONI DEL BOT ###
  37. while (my $input = <$sock>) {
  38.    chomp $input;
  39.     if ($input =~ /^PING(.*)$/i) {
  40.  
  41.         print $sock "PONG $1\r\n";
  42.     }
  43.     else {
  44.  
  45.         print "$input\n";
  46.         }
  47.        
  48.        
  49.    
  50. }
  51.  
  52.  
  53.  
  54.  if($input =~ /^:?(.+?)!~?(.+?)@.?: ciao|salve|buongiorno|buonasera|hi|hola|hello|bella/i)
  55.   {
  56.     print $sock "PRIVMSG $channel :Ciao e benvenuto $1 !\r\n";
  57.  
  58.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement