]> git.donarmstrong.com Git - infobot.git/blobdiff - src/UserExtra.pl
- don't list _default in chanstats
[infobot.git] / src / UserExtra.pl
index e38fa950b04a0495ff5fdadd765123d54564d028..cfd15aa1f509ae1c116f247e9e64dece494e91b3 100644 (file)
@@ -63,9 +63,12 @@ sub chaninfo {
                &ircCheck();
                next;
            }
-           push(@array, "$_ (".scalar(keys %{ $channels{$_}{''} }).")");
+           next if (/^_default$/);
+
+           my $str = sprintf("%s (%d)", $_, scalar(keys %{ $channels{$_}{''} }));
+           push(@array, $str);
        }
-       &pSReply($reply.": ".join(' ', @array));
+       &pSReply($reply.": ".join(', ', @array));
 
        ### total user count.
        foreach $chan (keys %channels) {
@@ -81,7 +84,7 @@ sub chaninfo {
                push(@nicks, $_);
            }
        }
-       &DEBUG("nicks => '".scalar(@nicks)."'...");
+
        if (scalar @nicks != $uucount) {
            &DEBUG("nicks != uucount...");
        }
@@ -221,8 +224,8 @@ sub factstats {
 
 sub karma {
     my $target = lc( shift || $who );
-    my $karma  = &dbGet("stats", "counter", "nick=".
-                       &dbQuote($target)." AND type='karma'") || 0; 
+    my $karma  = &sqlSelect("stats", "counter",
+       { nick => $target, type => "karma" }) || 0; 
 
     if ($karma != 0) {
        &pSReply("$target has karma of $karma");
@@ -803,11 +806,11 @@ sub userCommands {
        "Since $startString, there have been".
          " \002$count{'Update'}\002 ".
                &fixPlural("modification", $count{'Update'}).
-         " and \002$count{'Question'}\002 ".
+         ", \002$count{'Question'}\002 ".
                &fixPlural("question",$count{'Question'}).
-         " and \002$count{'Dunno'}\002 ".
+         ", \002$count{'Dunno'}\002 ".
                &fixPlural("dunno",$count{'Dunno'}).
-         " and \002$count{'Moron'}\002 ".
+         ", \002$count{'Moron'}\002 ".
                &fixPlural("moron",$count{'Moron'}).
          " and \002$count{'Commands'}\002 ".
                &fixPlural("command",$count{'Commands'}).
@@ -819,10 +822,9 @@ sub userCommands {
 
        return;
 
-       # todo: use dbGetColNiceHash().
        my %hash = &sqlSelectColHash("stats", "nick,counter",
                { type => "cmdstats" }, 1);
-# does ORDER matter when used with a hash?
+# ORDER won't be retained in a hash
 #                      " ORDER BY counter DESC", 1);
 
 if (0) {