]> git.donarmstrong.com Git - infobot.git/commitdiff
- fixup for question handling.
authordms <dms@c11ca15a-4712-0410-83d8-924469b57eb5>
Fri, 2 Feb 2001 13:12:38 +0000 (13:12 +0000)
committerdms <dms@c11ca15a-4712-0410-83d8-924469b57eb5>
Fri, 2 Feb 2001 13:12:38 +0000 (13:12 +0000)
git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk/blootbot@303 c11ca15a-4712-0410-83d8-924469b57eb5

src/Process.pl

index d699c234d06e387062a110a508ae09f226d024e4..616cac1230fc2e52a8f54890679eef2b5bb8be2f 100644 (file)
@@ -205,7 +205,6 @@ sub process {
 
     # thanks.
     if ($message =~ /^than(ks?|x)( you)?( \S+)?/i) {
-       &DEBUG("thanks: talkok => '$talkok', addressed => '$addressed'.");
        return 'thank: no addr' unless ($message =~ /$ident/ or $talkok);
 
        &performReply( &getRandom(keys %{$lang{'welcome'}}) );
@@ -560,7 +559,7 @@ sub FactoidStuff {
        return 'result from doQ undef.';
     }
 
-    if (defined $result and $result ne "") {           # question.
+    if (defined $result and $result !~ /^0?$/) {       # question.
        &status("question: <$who> $message");
        $count{'Question'}++;
     } elsif (&IsChanConf("perlMath") > 0 and $addressed) { # perl math.
@@ -573,33 +572,33 @@ sub FactoidStuff {
        }
     }
 
-    if ($result ne "") {
+    if ($result !~ /^0?$/) {
        &performStrictReply($result);
        return;
-    } else {
-       # why would a friendly bot get passed here?
-       if (&IsParam("friendlyBots")) {
-           return if (grep lc($_) eq lc($who), split(/\s+/, $param{'friendlyBots'}));
-       }
+    }
 
-       # do the statement.
-       if (defined &doStatement($message)) {
-           return;
-       }
+    # why would a friendly bot get passed here?
+    if (&IsParam("friendlyBots")) {
+       return if (grep lc($_) eq lc($who), split(/\s+/, $param{'friendlyBots'}));
+    }
 
-       return unless ($addressed);
+    # do the statement.
+    if (!defined &doStatement($message)) {
+       return;
+    }
 
-       if (length $message > 64) {
-           &status("unparseable-moron: $message");
-           &performReply( &getRandom(keys %{$lang{'moron'}}) );
-           $count{'Moron'}++;
-           return;
-       }
+    return unless ($addressed);
 
-       &status("unparseable: $message");
-       &performReply( &getRandom(keys %{$lang{'dunno'}}) );
-       $count{'Dunno'}++;
+    if (length $message > 64) {
+       &status("unparseable-moron: $message");
+       &performReply( &getRandom(keys %{$lang{'moron'}}) );
+       $count{'Moron'}++;
+       return;
     }
+
+    &status("unparseable: $message");
+    &performReply( &getRandom(keys %{$lang{'dunno'}}) );
+    $count{'Dunno'}++;
 }
 
 1;