Advertisement
Guest User

Untitled

a guest
Oct 3rd, 2012
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. #!/usr/bin/perl
  2. use Net::IRC;
  3. use PerlSpeak;
  4.  
  5. $irc = new Net::IRC;
  6.  
  7. $homechannel = "#nurds";
  8.  
  9. $ps = PerlSpeak->new();
  10. $ps->{tts_engine} = "festival";
  11.  
  12. $conn = $irc->newconn(Nick => 'prutbot3',
  13. Server => 'irc.oftc.net');
  14.  
  15. sub on_connect {
  16. my $self = shift;
  17.  
  18. $self->join($homechannel);
  19. print ("connect!\n");
  20. }
  21.  
  22. sub on_msg {
  23.  
  24. $event = $_[1];
  25. my $self = shift;
  26.  
  27. $input = $event->{args}[0];
  28.  
  29. if ($input =~ /^(.)say(.*)/) {
  30. $ps->say($2);
  31. }
  32.  
  33. if ($input =~ /^(.)flash(.*)/) {
  34. $ps->say("hark hark hark hark hark hark");
  35. }
  36.  
  37. }
  38.  
  39. $conn->add_handler('public', \&on_msg);
  40.  
  41. $conn->add_global_handler(376, \&on_connect);
  42.  
  43. $irc->start;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement