]> git.donarmstrong.com Git - infobot.git/blobdiff - src/UserExtra.pl
- updates to DEBUG/WARN/ERROR or the result of looking at them
[infobot.git] / src / UserExtra.pl
index 49124799e2198357b6867449391e81ceab1c12bd..23b287394c8e260a79a77333d52f9725d8b87f5b 100644 (file)
@@ -161,7 +161,7 @@ sub chaninfo {
     }
 
     # todo: show top 3 with percentages?
-    my($count) = (sort { $a <=> $b } keys %new)[0];
+    my($count) = (sort { $new{$a} <=> $new{$b} } keys %new)[0];
     if ($count) {
        $reply .= ".  \002$count\002 has said the most with a total of \002$new{$count}\002 messages";
     }
@@ -263,6 +263,9 @@ sub ispell {
        } elsif (/^\+/) {
            &DEBUG("spell: '+' found => '$_'.");
            last;
+       } elsif (/^# (.*?) 0$/) {
+           # none found.
+           last;
        } else {
            &DEBUG("spell: unknown: '$_'.");
        }
@@ -393,6 +396,11 @@ sub DNS {
     my $pid;
     $dns =~ s/^\s+|\s+$//g;
 
+    if (!defined $dns or $dns =~ /^\s*$/ or $dns =~ / /) {
+       &help("dns");
+       return;
+    }
+
     if ($dns =~ /(\d+\.\d+\.\d+\.\d+)/) {
        $match = $1;
        &status("DNS query by IP address: $match");
@@ -803,7 +811,10 @@ sub userCommands {
                        " ORDER BY counter DESC", 1);
 
        foreach (keys %hash) {
-           &DEBUG("cmdstats: hash{$_} => $hash{$_}");
+           my $i = $_;
+           foreach (keys %{ $hash{$i} }) {
+               &DEBUG("cmdstats: $hash{$i}{$_} = $_");
+           }
        }
        &DEBUG("end of cmdstats.");