LuminaWebsite/includes/activity_api.php
Maaxxs a252d8d180 Activity check: closing in the background with a "closing" status, color #206694 in the palette
- Website shows "Being closed …" and reloads itself until the bot has sent the DMs and role changes (previously the website timed out after 10 s even though the bot finished)
- Palette: new color dark blue #206694

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-22 01:39:45 +02:00

37 lines
1.4 KiB
PHP

<?php
declare(strict_types=1);
require_once __DIR__ . '/events_api.php';
/**
* Aktivitaetschecks des Discord-Bots (/api/activity-checks, cogs/activity.py im Bot).
* Der Bot postet die Nachricht mit den Buttons "Ich bin da" / "Ich bin nicht da", sammelt die
* Antworten und fuehrt beim Abschluss die Folgen aus - die Website legt Checks an, zeigt sie an
* und kann sie vorzeitig beenden.
*
* @param array<string, mixed> $queryParams
* @param array<string, mixed>|null $jsonBody
* @return array<string, mixed>
* @throws RuntimeException
*/
function activity_api_request(string $method, string $path = '', array $queryParams = [], ?array $jsonBody = null): array
{
$base = preg_replace('#/raids$#', '', raids_api_config()['url']);
return bot_api_request($method, $base . '/activity-checks' . $path, $queryParams, $jsonBody, 'Aktivitätscheck-API');
}
/** Farben zur schnellen Auswahl (Discord-Embed-Farbe links am Rand). */
const ACTIVITY_COLORS = [
'#c9a227' => 'Gold',
'#5865f2' => 'Blurple',
'#3ba55d' => 'Grün',
'#ed4245' => 'Rot',
'#f0b232' => 'Orange',
'#9b59b6' => 'Lila',
'#1abc9c' => 'Türkis',
'#206694' => 'Dunkelblau',
];
const ACTIVITY_DEFAULT_DM = 'Hallo {name}! Du hast dich beim Aktivitätscheck **{titel}** auf **{server}** nicht zurückgemeldet. '
. 'Melde dich bitte bei der Gildenleitung, wenn du weiterhin dabei sein möchtest.';