# HG changeset patch # User darius@inchoate.localdomain # Date 1204242628 -37800 # Node ID 3ef64337d86b63a5e5a757734cb8339f147c2651 # Parent fbaf34d7bab7df9218252c3c2d71ad4246d0be30 - Listen on #tea & #teabf - Only match !fp at the beginning of the line - Allow users to specify a search string but default to [tea] if none is specified. diff -r fbaf34d7bab7 -r 3ef64337d86b findplayer.pl --- a/findplayer.pl Tue Feb 26 16:49:48 2008 +1030 +++ b/findplayer.pl Fri Feb 29 10:20:28 2008 +1030 @@ -1,7 +1,7 @@ ############################################################################ # Run the game-monitor script when triggered # -# $Id: findplayer.pl,v 1.1 2007/08/25 05:19:37 darius Exp $ +# $Id$ ############################################################################ # # Copyright (C) 2007 Daniel O'Connor. All rights reserved. @@ -50,7 +50,8 @@ my ($server, $data, $nick, $address) = @_; my ($target, $text) = split(/ :/, $data, 2); - if (lc($target) ne "#teabf" && lc($target) ne "darius") { + #print CLIENTCRAP "target = \"$target\""; + if (lc($target) ne "#teabf" && lc($target) ne "#tea") { return; } #print CLIENTCRAP "target = \"$target\""; @@ -59,7 +60,7 @@ $text =~ s/\x03\d?\d?(,\d?\d?)?|\x02|\x1f|\x16|\x06|\x07//g; #print CLIENTCRAP "text is $text"; - if ($text =~ /!fp (.*)/) { + if ($text =~ /^!fp *(.*)/) { if ($lastran + Irssi::settings_get_int('fp_mininter') > time()) { print CLIENTCRAP "ignoring command from $nick"; return; @@ -67,10 +68,12 @@ $lastran = time(); my $string = $1; - #$string =~ s/[^0-9a-zA-Z .,\[\]]//g; - # print CLIENTCRAP "Target found - $string"; - # XXX: hard coded now - $string = "[TEA]"; + $string =~ s/[^0-9a-zA-Z .,\[\]]//g; + #print CLIENTCRAP "Target found - $string"; + if ($string eq "") { + $string = "[TEA]"; + #print CLIENTCRAP "No target, using [TEA]"; + } $server->command("msg $target Looking for \"$string\" on game-monitor.com..."); open (SCR, "-|", "/home/doconnor/bin/scrape-gm.py", $string); while () {