All pastes #773747 Raw Edit

Someone

public text v1 · immutable
·published 2007-11-14 19:21 UTC
rendered paste body
IRC::add_message_handler("PRIVMSG", "privmsg_handler");

open ( SHB, "<xchatscripts/shobon" );
 chomp( @shobon = <SHB> );
        close SHB;

IRC::add_command_handler("shobon", "do_shobon");

sub privmsg_handler {
   $thingy = $_[0];
   $_ = $thingy;
( $nick, $user, $host, $hook, $channel, $say ) = (m/:(\S+)!(\S+)\@(\S+)\s(\w+)\s(\S+)\s:(.*)/);
  if ($say =~ /^!shobon$/i ) {
         $answer = $shobon[rand @shobon];
            IRC::command("/say $answer");
}
   return 0;
}

sub do_shobon {
         $answer = $shobon[rand @shobon];
    IRC::command("/say $answer"); 
}