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>
204 lines
8.3 KiB
JavaScript
204 lines
8.3 KiB
JavaScript
(function () {
|
|
'use strict';
|
|
|
|
// ---- "Rolle hinzufügen" (Punkte-Gewichtung, zweistufiges Popup) ----
|
|
function initAddWeightModal() {
|
|
var modal = document.getElementById('report-add-role-modal');
|
|
var addBtn = document.getElementById('report-add-role-btn');
|
|
if (!modal || !addBtn) return;
|
|
|
|
var step1 = modal.querySelector('.report-role-step[data-step="1"]');
|
|
var step2 = modal.querySelector('.report-role-step[data-step="2"]');
|
|
var nextBtn = document.getElementById('report-role-step1-next');
|
|
var backBtn = document.getElementById('report-role-step2-back');
|
|
var submitBtn = document.getElementById('report-role-step2-submit');
|
|
var summaryEl = document.getElementById('report-role-step2-summary');
|
|
var pointsInput = document.getElementById('report-role-points');
|
|
var form = document.getElementById('report-add-role-form');
|
|
var pointsField = document.getElementById('report-add-role-points-field');
|
|
var idsContainer = document.getElementById('report-add-role-ids-container');
|
|
var closeBtn = modal.querySelector('.modal-close');
|
|
var checkboxes = modal.querySelectorAll('input[name="role_ids[]"]');
|
|
|
|
function showStep(n) {
|
|
step1.hidden = n !== 1;
|
|
step2.hidden = n !== 2;
|
|
}
|
|
|
|
function updateNextState() {
|
|
var anyChecked = Array.prototype.some.call(checkboxes, function (cb) { return cb.checked; });
|
|
nextBtn.disabled = !anyChecked;
|
|
}
|
|
|
|
function resetModal() {
|
|
checkboxes.forEach(function (cb) { cb.checked = false; });
|
|
pointsInput.value = '1';
|
|
updateNextState();
|
|
showStep(1);
|
|
}
|
|
|
|
addBtn.addEventListener('click', function () {
|
|
resetModal();
|
|
modal.hidden = false;
|
|
});
|
|
closeBtn.addEventListener('click', function () { modal.hidden = true; });
|
|
modal.addEventListener('click', function (e) {
|
|
if (e.target === modal) modal.hidden = true;
|
|
});
|
|
|
|
checkboxes.forEach(function (cb) {
|
|
cb.addEventListener('change', updateNextState);
|
|
});
|
|
|
|
nextBtn.addEventListener('click', function () {
|
|
var names = [];
|
|
checkboxes.forEach(function (cb) {
|
|
if (cb.checked) names.push(cb.getAttribute('data-role-name') || '');
|
|
});
|
|
summaryEl.textContent = names.join(', ');
|
|
showStep(2);
|
|
});
|
|
|
|
backBtn.addEventListener('click', function () {
|
|
showStep(1);
|
|
});
|
|
|
|
submitBtn.addEventListener('click', function () {
|
|
var points = pointsInput.value.trim();
|
|
if (points === '' || isNaN(Number(points))) {
|
|
pointsInput.focus();
|
|
return;
|
|
}
|
|
|
|
idsContainer.innerHTML = '';
|
|
checkboxes.forEach(function (cb) {
|
|
if (!cb.checked) return;
|
|
var hidden = document.createElement('input');
|
|
hidden.type = 'hidden';
|
|
hidden.name = 'role_ids[]';
|
|
hidden.value = cb.value;
|
|
idsContainer.appendChild(hidden);
|
|
});
|
|
pointsField.value = points;
|
|
form.submit();
|
|
});
|
|
}
|
|
|
|
// ---- "Rolle ausschließen" (Timeout-Ausnahmen, einstufiges Popup) ----
|
|
function initAddExclusionModal() {
|
|
var modal = document.getElementById('report-add-exclusion-modal');
|
|
var addBtn = document.getElementById('report-add-exclusion-btn');
|
|
if (!modal || !addBtn) return;
|
|
|
|
var closeBtn = modal.querySelector('.modal-close');
|
|
var submitBtn = document.getElementById('report-exclusion-submit');
|
|
var form = document.getElementById('report-add-exclusion-form');
|
|
var idsContainer = document.getElementById('report-add-exclusion-ids-container');
|
|
var checkboxes = modal.querySelectorAll('input[name="role_ids[]"]');
|
|
|
|
addBtn.addEventListener('click', function () {
|
|
checkboxes.forEach(function (cb) { cb.checked = false; });
|
|
modal.hidden = false;
|
|
});
|
|
closeBtn.addEventListener('click', function () { modal.hidden = true; });
|
|
modal.addEventListener('click', function (e) {
|
|
if (e.target === modal) modal.hidden = true;
|
|
});
|
|
|
|
submitBtn.addEventListener('click', function () {
|
|
idsContainer.innerHTML = '';
|
|
var anyChecked = false;
|
|
checkboxes.forEach(function (cb) {
|
|
if (!cb.checked) return;
|
|
anyChecked = true;
|
|
var hidden = document.createElement('input');
|
|
hidden.type = 'hidden';
|
|
hidden.name = 'role_ids[]';
|
|
hidden.value = cb.value;
|
|
idsContainer.appendChild(hidden);
|
|
});
|
|
if (!anyChecked) return;
|
|
form.submit();
|
|
});
|
|
}
|
|
|
|
// ---- Nach gemeldetem Nutzer filtern (eigenes Dropdown mit Avataren) ----
|
|
function initUserFilter() {
|
|
var wrapper = document.getElementById('report-user-filter');
|
|
var trigger = document.getElementById('report-user-filter-trigger');
|
|
var triggerContent = document.getElementById('report-user-filter-trigger-content');
|
|
var panel = document.getElementById('report-user-filter-panel');
|
|
var options = panel ? panel.querySelectorAll('.user-filter-option') : [];
|
|
var rows = document.querySelectorAll('.report-card');
|
|
var emptyMessage = document.getElementById('report-filter-empty');
|
|
if (!wrapper || !trigger || !panel || !options.length || !rows.length) return;
|
|
|
|
function closePanel() {
|
|
panel.classList.remove('open');
|
|
panel.hidden = true;
|
|
trigger.classList.remove('open');
|
|
trigger.setAttribute('aria-expanded', 'false');
|
|
}
|
|
|
|
function openPanel() {
|
|
panel.hidden = false;
|
|
requestAnimationFrame(function () { panel.classList.add('open'); });
|
|
trigger.classList.add('open');
|
|
trigger.setAttribute('aria-expanded', 'true');
|
|
}
|
|
|
|
trigger.addEventListener('click', function () {
|
|
if (panel.classList.contains('open')) {
|
|
closePanel();
|
|
} else {
|
|
openPanel();
|
|
}
|
|
});
|
|
|
|
document.addEventListener('click', function (e) {
|
|
if (!wrapper.contains(e.target)) closePanel();
|
|
});
|
|
|
|
document.addEventListener('keydown', function (e) {
|
|
if (e.key === 'Escape') closePanel();
|
|
});
|
|
|
|
options.forEach(function (option) {
|
|
option.addEventListener('click', function () {
|
|
var userId = option.getAttribute('data-user-id') || '';
|
|
var visual = option.querySelector('.user-filter-option-visual');
|
|
|
|
options.forEach(function (o) {
|
|
var isSelected = o === option;
|
|
o.classList.toggle('selected', isSelected);
|
|
o.setAttribute('aria-selected', isSelected ? 'true' : 'false');
|
|
});
|
|
|
|
if (visual) triggerContent.innerHTML = visual.innerHTML;
|
|
closePanel();
|
|
|
|
var visibleCount = 0;
|
|
rows.forEach(function (row) {
|
|
var matches = userId === '' || row.getAttribute('data-reported-id') === userId;
|
|
row.hidden = !matches;
|
|
if (matches) visibleCount++;
|
|
});
|
|
if (emptyMessage) emptyMessage.hidden = visibleCount !== 0;
|
|
|
|
// "Alle Reports loeschen" gilt dem gewaehlten Spieler
|
|
var clearForm = document.getElementById('report-clear-user');
|
|
if (clearForm) {
|
|
var name = option.getAttribute('data-user-name') || '';
|
|
clearForm.hidden = userId === '';
|
|
clearForm.elements.reported_id.value = userId;
|
|
clearForm.querySelector('[data-label]').textContent = 'Alle Reports von ' + name + ' löschen';
|
|
clearForm.setAttribute('data-confirm', 'Alle Reports gegen ' + name + ' endgültig löschen - auch archivierte? Ein Auto-Mute wird aufgehoben.');
|
|
}
|
|
});
|
|
});
|
|
}
|
|
|
|
initAddWeightModal();
|
|
initAddExclusionModal();
|
|
initUserFilter();
|
|
})();
|