]> ruin.nu Git - NDIRC.git/blobdiff - Commands/Scans.pm
Merge branch 'discord'
[NDIRC.git] / Commands / Scans.pm
index 8ea51ffc4b1fa89a775157f0ee775c8642db0f90..193e486c46b80b6c094988876338415e689040be 100644 (file)
@@ -83,14 +83,14 @@ WHERE uid = $1
 UPDATE scan_requests SET nick = $1, tick = tick(), time = NOW()
 WHERE id = $2
                                        });
-                               $req->execute($c->nick,$scan->{id});
+                               $req->execute($c->replyId,$scan->{id});
                                $id = $scan->{id};
                        }else{
                                $req = $c->model->prepare(q{
 INSERT INTO scan_requests (uid,nick,pid,type)
 VALUES($1,$2,$3,$4) RETURNING (id)
                                        });
-                               $req->execute($c->uid,$c->nick,$planet,$type);
+                               $req->execute($c->uid,$c->replyId,$planet,$type);
                                $id = $req->fetchrow;
                        }
 
@@ -100,9 +100,9 @@ VALUES($1,$2,$3,$4) RETURNING (id)
                                }else{
                                        $dists = "DISTS UNKNOWN, ADD DEVSCAN"
                                }
-                               $c->message(privmsg => $c->disp->targets->{scan}
-                                       ,"<b>$id</b> http://game.planetarion.com/waves.pl?id=$typeid&x=$x&y=$y&z=$z"
-                                       . " ($x:$y:$z $type - $dists) | <".$c->nick."> $msg"
+                               $c->bot->toTarget( scan =>
+                                       "<b>$id</b> http://game.planetarion.com/waves.pl?id=$typeid&x=$x&y=$y&z=$z"
+                                       . " ($x:$y:$z $type - $dists) | <".$c->username."> $msg"
                                );
                                $c->reply("sent request ($x:$y:$z $type)");
                        }else{
@@ -121,6 +121,7 @@ my %scantypes;
 command scanreqs => {
        help => q(syntax: .scanreqs [-pdunja] | Lists scan requests that haven't been handled. The argument can be used to omit types you don't have, like .scanreqs -ja to list all requests except jumpgates and advanced unit scans.),
        acl => q(irc_scanreqs),
+       type => q{scan},
 }, class extends NDIRC::Command {
        method execute($c,$msg) {
                my @notype;
@@ -200,6 +201,7 @@ SELECT ship,amount FROM fleet_ships WHERE fid = $1 ORDER BY num
 
 command addscan => {
        help => q(syntax: .addscan list of scans),
+       type => q(universal),
 }, class extends NDIRC::Command {
        method execute($c,$msg) {
                my $dbh = $c->model;
@@ -212,7 +214,7 @@ WHERE groupscan = $1 AND scan_id = LOWER($2) AND tick >= tick() - 168
 INSERT INTO scans (scan_id,tick,groupscan,uid) VALUES (LOWER($1),tick(),$2,COALESCE($3,-1))
                        });
                my $user = $dbh->selectrow_hashref(q{SELECT uid,username, scan_points, tick()
-                       FROM users WHERE uid = ? },undef,$c->uid);
+                       FROM users WHERE uid = ? AND uid > 0 },undef,$c->uid);
                my $groupscans = 0;
                my $scans = 0;
                eval {