The bot (Aion2_RaidPlaner, deployed 2026-09-25) has no slash commands any more. Raids,
premades, events, activity checks and reports are created and managed only here; in Discord
members sign up for raids, answer invitations and activity checks and report players.
- Raid signup works the same in Discord and here: the bot assigns the group (perform_signup),
the website only sends the wish (raid_signup(..., $wish)) and shows the reason when it did
not fit (locked, role full, raid full). raid_wish_is_sensible() and the role constants are
gone. Declining ("Abmelden") now keeps the player under "Abgemeldet" (raid_decline, new bot
endpoint .../decline) like in Discord; the raid card shows "Du hast dich abgemeldet" with
"Doch anmelden". Class input is checked against AION_CLASSES.
- The Discord message shows the raid lead and the Lumipunkte: raid_create_action/raid_edit_action
send lead_id/lead_name/points_text, raid_sync_extras() on raids.php pushes them for raids
where the bot is missing them (at most 3 per page view, follows changed raid IDs).
- bot_api.php?action=member: main class (profile choice) and whether the person has an
(active) account - the bot preselects the class and hints that Lumipunkte need an account.
- New page Verwaltung -> Discord-Bot (admin/bot.php, includes/discord_bot.php, permission
bot.manage, on update granted to groups with raids.manage; schema 53): raid, log and report
channel, post the premade overview (updates itself) and the report panel (the bot replaces
the previous one), resync all raid messages (reposted raids move their settings via
raid_rename_id). Audit area "Discord-Bot", sidebar entry with a new bot icon.
- Reports: after picking a player in the filter, delete all of their reports at once
(DELETE /api/reports/user/{id}), which also lifts the auto-mute.
- Calendar and raid logs no longer count declined players as signed up / on the bench.
- Texts that mentioned bot commands (events, activity check, config example, README) updated;
privacy policy mentions the main-class lookup and that declines stay visible. Patch notes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
122 lines
5.5 KiB
PHP
122 lines
5.5 KiB
PHP
<?php
|
||
/**
|
||
* Verwaltung -> Discord-Bot: Kanaele, Premade-Uebersicht und Melde-Panel, Raid-Nachrichten abgleichen
|
||
* (includes/discord_bot.php). Ersetzt die Slash-Befehle, die es im Bot seit dem Umbau (09/2026) nicht mehr gibt.
|
||
*/
|
||
require_once __DIR__ . '/../includes/bootstrap.php';
|
||
require_once __DIR__ . '/../includes/discord_bot.php';
|
||
require_permission('bot.manage');
|
||
|
||
$settings = [];
|
||
$channels = [];
|
||
$apiError = null;
|
||
try {
|
||
$settings = discord_bot_settings();
|
||
$channels = fetch_guild_channels();
|
||
} catch (Throwable $e) {
|
||
$apiError = $e->getMessage();
|
||
}
|
||
|
||
/**
|
||
* Auswahl eines Textkanals. Kanaele, in denen der Bot nicht posten darf, sind ausgegraut.
|
||
*
|
||
* @param array<int, array<string, mixed>> $channels
|
||
*/
|
||
function bot_channel_select(string $name, string $id, array $channels, string $selected, string $placeholder): void
|
||
{
|
||
?>
|
||
<select name="<?= e($name) ?>" id="<?= e($id) ?>">
|
||
<option value=""<?= $selected === '' ? ' selected' : '' ?>><?= e($placeholder) ?></option>
|
||
<?php foreach ($channels as $channel): ?>
|
||
<?php $cid = (string) ($channel['channel_id'] ?? ''); ?>
|
||
<option value="<?= e($cid) ?>"<?= $cid === $selected ? ' selected' : '' ?><?= empty($channel['can_post']) && $cid !== $selected ? ' disabled' : '' ?>>
|
||
#<?= e((string) ($channel['name'] ?? '')) ?><?php if (!empty($channel['category'])): ?> (<?= e((string) $channel['category']) ?>)<?php endif; ?><?= empty($channel['can_post']) ? ' – Bot darf hier nicht posten' : '' ?>
|
||
</option>
|
||
<?php endforeach; ?>
|
||
</select>
|
||
<?php
|
||
}
|
||
|
||
$pageTitle = 'Discord-Bot';
|
||
include __DIR__ . '/../includes/header.php';
|
||
?>
|
||
<div class="panel">
|
||
<h1>Discord-Bot</h1>
|
||
<p class="text-muted">
|
||
Im Discord wird nichts mehr erstellt oder verwaltet – Raids, Premades, Events, Aktivitätschecks und
|
||
Reports laufen über die Website. Der Bot zeigt an, erinnert und nimmt Raid-Anmeldungen und Meldungen
|
||
entgegen. Hier legst du fest, wohin er postet.
|
||
</p>
|
||
</div>
|
||
|
||
<?php if ($apiError !== null): ?>
|
||
<div class="panel">
|
||
<div class="flash flash-error">Der Bot ist gerade nicht erreichbar: <?= e($apiError) ?></div>
|
||
</div>
|
||
<?php else: ?>
|
||
<div class="panel">
|
||
<h2>Kanäle</h2>
|
||
<form method="post" action="/admin/bot_action.php" class="bot-admin-form">
|
||
<?= csrf_field() ?>
|
||
<input type="hidden" name="action" value="channels">
|
||
<?php foreach (DISCORD_BOT_CHANNELS as $key => [$label, $hint]): ?>
|
||
<div>
|
||
<label for="bot-<?= e($key) ?>"><?= e($label) ?></label>
|
||
<?php bot_channel_select($key, 'bot-' . $key, $channels, $settings[$key] ?? '', '– nicht festgelegt –'); ?>
|
||
<div class="field-hint"><?= e($hint) ?></div>
|
||
</div>
|
||
<?php endforeach; ?>
|
||
<div class="actions">
|
||
<button type="submit">Kanäle speichern</button>
|
||
</div>
|
||
</form>
|
||
</div>
|
||
|
||
<div class="panel">
|
||
<h2>Übersichten im Discord</h2>
|
||
<p class="text-muted">
|
||
Der Bot merkt sich, wo sie stehen. Postest du sie neu, löscht er die bisherige. Was früher per
|
||
Befehl im Discord gepostet wurde, kennt er nicht – das nach dem Neu-Posten dort von Hand löschen.
|
||
</p>
|
||
<div class="bot-panels">
|
||
<?php foreach (DISCORD_BOT_PANELS as $kind => [$label, $path, $hint]): ?>
|
||
<?php $current = $settings[$kind === 'premades' ? 'premade_panel_channel' : 'report_panel_channel'] ?? ''; ?>
|
||
<form method="post" action="/admin/bot_action.php" class="bot-admin-form bot-panel">
|
||
<?= csrf_field() ?>
|
||
<input type="hidden" name="action" value="panel">
|
||
<input type="hidden" name="kind" value="<?= e($kind) ?>">
|
||
<h3><?= e($label) ?></h3>
|
||
<p class="text-muted"><?= e($hint) ?></p>
|
||
<p>
|
||
<?php if ($current !== ''): ?>
|
||
Steht in <strong><?= e(discord_bot_channel_label($current, $channels)) ?></strong>.
|
||
<?php else: ?>
|
||
<span class="text-muted">Noch nicht über die Website gepostet.</span>
|
||
<?php endif; ?>
|
||
</p>
|
||
<div>
|
||
<label for="bot-panel-<?= e($kind) ?>">Kanal</label>
|
||
<?php bot_channel_select('channel_id', 'bot-panel-' . $kind, $channels, $current, '– Kanal wählen –'); ?>
|
||
</div>
|
||
<div class="actions">
|
||
<button type="submit" class="button-secondary"><?= $current !== '' ? 'Neu posten' : 'Posten' ?></button>
|
||
</div>
|
||
</form>
|
||
<?php endforeach; ?>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="panel">
|
||
<h2>Raid-Nachrichten abgleichen</h2>
|
||
<p class="text-muted">
|
||
Bringt die Nachrichten aller aktiven Raids im Discord auf den Stand der Website und postet fehlende
|
||
neu – etwa wenn jemand eine Raid-Nachricht gelöscht hat.
|
||
</p>
|
||
<form method="post" action="/admin/bot_action.php" class="inline-form">
|
||
<?= csrf_field() ?>
|
||
<input type="hidden" name="action" value="resync">
|
||
<button type="submit" class="button-secondary"><?= icon('restore') ?> Jetzt abgleichen</button>
|
||
</form>
|
||
</div>
|
||
<?php endif; ?>
|
||
<?php include __DIR__ . '/../includes/footer.php'; ?>
|