SET sent = TRUE WHERE id = ANY($1)
});
$scans->execute;
+ my @scanreqs;
while (my $scan = $scans->fetchrow_hashref){
$self->message("($scan->{coords} $scan->{type})"
." http://game.planetarion.com/showscan.pl?scan_id=$scan->{scan_id}"
, @{$scan->{nick}});
$sentscan->execute($scan->{id});
+ push @scanreqs, @{$scan->{id}};
+ }
+
+ if (scalar @scanreqs > 0)
+ {
+ my $scanreqs = join(', ', @scanreqs);
+ $self->toTarget(scan => "Handled the following requests: $scanreqs");
}
my @row = $dbh->selectrow_array(q{SELECT tick(), max(tick) FROM planet_stats});
if (defined $row[1] && $stattick != $row[1]){
$stattick = $row[1];
$self->toTarget(spam => "New tick: $stattick");
+ my $raids = $dbh->prepare(q{UPDATE raids SET open = true WHERE NOT open AND NOT removed AND open_tick <= $1 RETURNING id});
+ $raids->execute($stattick);
+ while (my $raid = $raids->fetchrow_hashref) {
+ $self->toTarget(members => "\@everyone Raid is now open: https://nd.ruin.nu/raids/view/$raid->{id}");
+ }
}
my $ircreqs = $dbh->prepare(q{SELECT id,username,message,channel FROM irc_requests NATURAL JOIN users WHERE not sent});
my $upircreq = $dbh->prepare(q{UPDATE irc_requests SET sent = TRUE WHERE id = ?});