]> git.donarmstrong.com Git - infobot.git/commitdiff
fix up default and standard factoid commands
authordondelelcaro <dondelelcaro@c11ca15a-4712-0410-83d8-924469b57eb5>
Sun, 9 Mar 2014 04:35:45 +0000 (04:35 +0000)
committerdondelelcaro <dondelelcaro@c11ca15a-4712-0410-83d8-924469b57eb5>
Sun, 9 Mar 2014 04:35:45 +0000 (04:35 +0000)
git-svn-id: https://svn.code.sf.net/p/infobot/code/branches/don/dpkg@1938 c11ca15a-4712-0410-83d8-924469b57eb5

src/Factoids/Question.pl

index 06f81346f49d7b85173b76f602046e380464a86a..836fc11c19b60188ea936df0a99a349b13dabed6 100644 (file)
@@ -208,21 +208,23 @@ sub factoidArgs {
     # 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', "^$chan cmd: $first " );
-      &searchTable( 'factoids', 'factoid_key', 'factoid_key', "^cmd: $first " );
+        (&searchTable( 'factoids', 'factoid_key', 'factoid_key', "^$chan cmd: $first " ),
+         &searchTable( 'factoids', 'factoid_key', 'factoid_key', "^_default cmd: $first " ),
+         &searchTable( 'factoids', 'factoid_key', 'factoid_key', "^cmd: $first " );
 
     &DEBUG("chan is $chan, first is $first; searching for '^$chan cmd: $first' ");
 
     #    my $delta_time = &timedelta($t);
     #    &DEBUG("factArgs: delta_time = $delta_time s");
-    &DEBUG("factArgs: list => ".scalar(@list) );
+    &DEBUG("factArgs: list[.".scalar(@list))."] => ".join(',',map {qq('$_')} @list) );
 
     # from a design perspective, it's better to have the regex in
     # the factoid key to reduce repetitive processing.
 
     # it does not matter if it's not alphabetically sorted.
     foreach ( (sort { length($b) <=> length($a) } grep {$_ =~ /^\Q$chan \E/} @list),
-              (sort { length($b) <=> length($a) } grep {$_ !~ /^\Q$chan \E/} @list)
+              (sort { length($b) <=> length($a) } grep {$_ =~ /^\Q_default \E/} @list)
+              (sort { length($b) <=> length($a) } grep {$_ !~ /^(\Q$chan\E|default) /} @list)
             ) {
         next if (/#DEL#/);    # deleted.