]> git.donarmstrong.com Git - infobot.git/blobdiff - src/Process.pl
foo+1 does not work on sqlReplace for sqlite.
[infobot.git] / src / Process.pl
index 75499a23770993099d5bacaa520d7f4c954bcc74..3563866c101790061fd01d4750c9124dab7e2e09 100644 (file)
@@ -314,19 +314,20 @@ sub process {
            return;
        }
 
-       my $karma = &dbGet("stats", "counter",
-               "nick=".&dbQuote($term)." AND type='karma'") || 0;
+       my $karma = &sqlSelect("stats", "counter",
+               { nick => $term, type => "karma" }) || 0;
        if ($inc eq '++') {
            $karma++;
        } else {
            $karma--;
        }
 
-       &dbSet("stats", 
-               { nick => $term, type => "karma" },     # WHERE
-#              { counter => $karma }                   # WHAT
-               { -counter => "counter+1" }
-       );
+       &sqlReplace("stats", {
+           nick        => $term,
+           type        => "karma",
+           'time'      => time(),
+           counter     => $karma,
+       } );
 
        return;
     }
@@ -343,6 +344,15 @@ sub process {
            return 'SOMETHING 1';
        }
 
+       # allow administration of bot via messages (default is DCC CHAT only)
+       if (&IsFlag("A")) {
+           &loadMyModule( $myModules{'ircdcc'} );
+           $er = &userDCC();
+           if (!defined $er) {
+               return 'SOMETHING 2';
+           }
+       }
+
        if (0 and $addrchar) {
            &msg($who, "I don't trust people to use the core commands while addressing me in a short-cut way.");
            return;