From: Michael Andreen Date: Fri, 2 Apr 2021 12:40:37 +0000 (+0200) Subject: Open and announce raids in member channel X-Git-Url: https://ruin.nu/git/?p=NDIRC.git;a=commitdiff_plain;h=4c2994d62294e1ea2232627b09eb2254ef82f264 Open and announce raids in member channel --- diff --git a/Delling.pm b/Delling.pm index c6df7f2..4f77984 100644 --- a/Delling.pm +++ b/Delling.pm @@ -172,6 +172,11 @@ sub refresh { 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 = ?});