swarley

lolcat.pl

Mar 16th, 2012
173
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. use strict;
  2. use warnings;
  3. use Xchat ':all';
  4. use Acme::LOLCAT;
  5.  
  6. sub lolzify {
  7.     Xchat::command('SAY ' . translate($_[1][0]));
  8.     return Xchat::EAT_ALL;
  9. }
  10.  
  11. my $hook = Xchat::hook_command('', 'lolzify');
  12.  
  13. sub unhook_eet {
  14.     Xchat::unhook($hook);
  15.     $hook = 0;
  16. }
  17.  
  18. sub rehook_eet {
  19.     $hook = Xchat::hook_command('', 'lolzify');
  20. }
  21.  
  22. sub lolcat {
  23.     if(defined $_[0][1]) {
  24.         if(lc($_[0][1]) eq "on") {
  25.             if(!$hook) {
  26.                 rehook_eet();
  27.             }
  28.         }
  29.         elsif(lc($_[0][1]) eq "off") {
  30.             if($hook) {
  31.                 unhook_eet();
  32.             }
  33.         }
  34.         else {
  35.             ($hook) ? XChat::print(translate("Its on!")) : Xchat::print(translate("Its off :["));
  36.         }
  37.     }
  38. }
  39.  
  40. Xchat::hook_command('lolcat','lolcat');
RAW Paste Data