From 4c2994d62294e1ea2232627b09eb2254ef82f264 Mon Sep 17 00:00:00 2001 From: Michael Andreen Date: Fri, 2 Apr 2021 14:40:37 +0200 Subject: [PATCH] Open and announce raids in member channel --- Delling.pm | 5 +++++ 1 file changed, 5 insertions(+) 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 = ?}); -- 2.39.2