diff options
author | RaindropsSys <raindrops@equestria.dev> | 2024-04-04 18:06:26 +0200 |
---|---|---|
committer | RaindropsSys <raindrops@equestria.dev> | 2024-04-04 18:06:26 +0200 |
commit | 37bcc4a2a777ce030f95fb8a0aee61a2e7edef6b (patch) | |
tree | 124c4886d5ced368627927d66fbac917a1d38a58 | |
parent | 6b796258d413f00e498ce7f80f73a9f6c061f29c (diff) | |
download | pluralconnect-37bcc4a2a777ce030f95fb8a0aee61a2e7edef6b.tar.gz pluralconnect-37bcc4a2a777ce030f95fb8a0aee61a2e7edef6b.tar.bz2 pluralconnect-37bcc4a2a777ce030f95fb8a0aee61a2e7edef6b.zip |
Updated 3 files (automated)
-rw-r--r-- | api/violette.php | 2 | ||||
-rw-r--r-- | daemons/next.php | 16 | ||||
-rw-r--r-- | jobs/FrontersNotification.php | 2 |
3 files changed, 14 insertions, 6 deletions
diff --git a/api/violette.php b/api/violette.php index 52a0566..19857c9 100644 --- a/api/violette.php +++ b/api/violette.php @@ -6,7 +6,7 @@ $data = [ "count" => count($list), "ponies" => array_values(array_map(function ($i) { return [ - "url" => $i["avatar_url"] ?? null, + "url" => $i["avatar_url"] ?? "", "label" => $i["display_name"] ?? $i["name"] ]; }, $list)) diff --git a/daemons/next.php b/daemons/next.php index c004a66..5fcb6c3 100644 --- a/daemons/next.php +++ b/daemons/next.php @@ -110,6 +110,10 @@ usort($pairs2, function ($a, $b) use ($members) { if (getLastFronted($members, $id) > 0) $times[] = getLastFronted($members, $id); } + if (count($times) === 0) { + $times[] = INF; + } + $timeA = time() - min($times); $times = []; @@ -117,6 +121,10 @@ usort($pairs2, function ($a, $b) use ($members) { if (getLastFronted($members, $id) > 0) $times[] = getLastFronted($members, $id); } + if (count($times) === 0) { + $times[] = INF; + } + $timeB = time() - min($times); if ($timeA < 5 || $timeB < 5) { @@ -142,11 +150,11 @@ $list = [$requested[$i]]; if (count($list) > 1) { $str = implode(" or ", array_map(function ($i) { return (getMemberWithoutSystem($i)["display_name"] ?? getMemberWithoutSystem($i)["name"]); - }, $list)) . " is fronting today."; + }, $list)) . " is fronting this week."; } elseif (count($list) > 0) { - $str = (getMemberWithoutSystem($list[0])["display_name"] ?? getMemberWithoutSystem($list[0])["name"]) . " is fronting today."; + $str = (getMemberWithoutSystem($list[0])["display_name"] ?? getMemberWithoutSystem($list[0])["name"]) . " is fronting this week."; } else { - $str = "We couldn't tell who will front today, sorry."; + $str = "We couldn't tell who will front this week, sorry."; } $context = stream_context_create([ @@ -154,7 +162,7 @@ $context = stream_context_create([ 'method' => 'POST', 'header' => "Content-Type: text/plain\r\n" . - "Title: " . formatPonypush("🎠 Pony fronting today") . "\r\n" . + "Title: " . formatPonypush("🎛️ Pony fronting this week") . "\r\n" . "Priority: high\r\n" . "Tags: schedule\r\n" . "Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]), diff --git a/jobs/FrontersNotification.php b/jobs/FrontersNotification.php index ebe9213..c092eec 100644 --- a/jobs/FrontersNotification.php +++ b/jobs/FrontersNotification.php @@ -74,7 +74,7 @@ if (count($fronters["members"]) > 1) { "Tags: switch\r\n" . "Actions: view, View on PluralKit, https://dash.pluralkit.me/profile/s/" . $system . ", clear=true\r\n" . "Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]), - 'content' => formatPonypush("The fallback pony switched in just now") + 'content' => formatPonypush("$name now does not have a member at front") ] ]); } |