use strict; use warnings; use Xchat qw( :all ); register('Oink Script', '0.3', 'Oink at the channel'); foreach ('Channel Message', 'Channel Msg Hilight') { hook_print($_, \&check_oink); } sub check_oink { my @words = split(/\s/, $_[0][1]); return EAT_NONE unless(lc $words[0] eq 'oink'); my $userinfo = user_info($_[0][0]); if ($userinfo->{prefix} && $userinfo->{prefix} ne '+') { delaycommand("me oinks"); } else { hook_timer( 0, sub { prnt("No oink sent for peons"); return REMOVE; }); } return EAT_NONE; } # Same thing as before for XChat 2.8.6 and newer, just white space removed sub delaycommand { my $command = $_[0]; hook_timer( 0, sub { command($command); return REMOVE; } ); return EAT_NONE; }