]> git.donarmstrong.com Git - infobot.git/blobdiff - src/Factoids/Question.pl
pipes in nicks
[infobot.git] / src / Factoids / Question.pl
index db7da14e438ee26c7a9d50c07f697166c55dcbc3..c269117a7f423228a0a9069a9f5761729698ce84 100644 (file)
@@ -188,6 +188,9 @@ sub factoidArgs {
     # TODO: cache this, update cache when altered. !!! !!! !!!
 #    my $t = &timeget();
     my ($first) = split(/\s+/, $str);
+
+    # ignore split to commands [dumb commands vs. factoids] (editing commands?)
+    return undef if $str =~ /\s+\=\~\s+s[\#\/\:]/;
     my @list = &searchTable("factoids", "factoid_key", "factoid_key", "^cmd: $first ");
 #    my $delta_time = &timedelta($t);
 #    &DEBUG("factArgs: delta_time = $delta_time s");
@@ -238,7 +241,7 @@ sub factoidArgs {
        }
 
        # update stats. old mysql/sqlite don't do +1
-       my ($count) = &sqlSelect("factoids", "requested_count", { factoid_key => $factoid });
+       my ($count) = &sqlSelect("factoids", "requested_count", { factoid_key => $q });
        $count++;
        &sqlSet("factoids", {'factoid_key' => $q}, {
                requested_by    => $nuh,
@@ -249,9 +252,14 @@ sub factoidArgs {
        # end of update stats.
 
        $result = $r;
+
        $result =~ s/^\((.*?)\): //;
+       my $vars = $1;
+
+       # start nasty hack to get partial &getReply() functionality.
+       $result = &SARit($result);
 
-       foreach ( split(',', $1) ) {
+       foreach ( split(',', $vars) ) {
            my $val = $vals[$i];
 #          &DEBUG("val => $val");
 
@@ -264,7 +272,7 @@ sub factoidArgs {
            my $old = $result;
            while (1) {
 #              &DEBUG("Q: result => $result (1before)");
-               $result = &substVars($result);
+               $result = &substVars($result,1);
 #              &DEBUG("Q: result => $result (1after)");
 
                last if ($old eq $result);
@@ -275,17 +283,16 @@ sub factoidArgs {
            # hack.
            $vals[$i] =~ s/^me$/$who/gi;
 
-           if (!$done) {
+#          if (!$done) {
                &status("factArgs: SARing '$_' to '$vals[$i]'.");
                $result =~ s/\Q$_\E/$vals[$i]/g;
-           }
+#          }
            $i++;
        }
 
-       # nasty hack to get partial &getReply() functionality.
+       # rest of nasty hack to get partial &getReply() functionality.
        $result =~ s/^\s*<action>\s*(.*)/\cAACTION $1\cA/i;
        $result =~ s/^\s*<reply>\s*//i;
-       $result = &SARit($result);
 
 # well... lets go through all of them. not advisable if we have like
 # 1000 commands, heh.