]> git.donarmstrong.com Git - infobot.git/blobdiff - src/Factoids/Reply.pl
ws
[infobot.git] / src / Factoids / Reply.pl
index 55d02a07ac8a83e8f965d71259cfd801fc97961b..056f947e4100475dfe3ddf69642111c7e33e6d1c 100644 (file)
@@ -27,8 +27,9 @@ sub getReply {
     }
 
     $message =~ tr/A-Z/a-z/;
+    $message =~ s/^cmd:/CMD:/;
 
-    my ($count, $fauthor, $result) = &sqlSelect("factoids", 
+    my ($count, $fauthor, $result) = &sqlSelect("factoids",
        "requested_count,created_by,factoid_value",
        { factoid_key => $message }
     );
@@ -152,10 +153,7 @@ sub smart_replace {
     foreach (split //, $string) {
 
        if ($_ eq "(") {
-###        print "( l=>$l, r=>$r\n";
-
            if (!$l and !$r) {
-#              print "STARTING at $i\n";
                $s = $i;
                $t = $i;
            }
@@ -165,25 +163,21 @@ sub smart_replace {
        }
 
        if ($_ eq ")") {
-###        print ") l=>$l, r=>$r\n";
-
            $r++;
            $l--;
 
            if (!$l and !$r) {
                my $substr = substr($old,$s,$i-$s+1);
-#              print "STOP at $i $substr\n";
                push(@rand, substr($old,$t+1,$i-$t-1) );
 
                my $rand = $rand[rand @rand];
-               &status("SARing '$substr' to '$rand'.");
+#              &status("SARing '$substr' to '$rand'.");
                $string =~ s/\Q$substr\E/$rand/;
                undef @rand;
            }
        }
 
        if ($_ eq "|" and $l+$r== 0 and $l==1) {
-#          print "| at $i (l=>$l,r=>$r)\n";
            push(@rand, substr($old,$t+1,$i-$t-1) );
            $t = $i;
        }