mirror of
https://github.com/arthur-pbty/LazyBot.git
synced 2026-06-03 23:36:37 +02:00
add anti raide & warn commands
This commit is contained in:
+123
-3
@@ -439,11 +439,11 @@ body {
|
||||
border-radius: var(--border-radius);
|
||||
font-size: 0.9rem;
|
||||
font-weight: 500;
|
||||
display: none;
|
||||
min-height: 1.5em;
|
||||
}
|
||||
|
||||
.status-message.show {
|
||||
display: block;
|
||||
.status-message:empty {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.status-message.success {
|
||||
@@ -1166,3 +1166,123 @@ body {
|
||||
background: #c0392b;
|
||||
}
|
||||
|
||||
/* ===== Anti-Raid Styles ===== */
|
||||
.antiraid-modules {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--spacing-md);
|
||||
}
|
||||
|
||||
.antiraid-module {
|
||||
background: var(--bg-dark);
|
||||
border-radius: var(--radius-md);
|
||||
border: 1px solid var(--border-color);
|
||||
overflow: hidden;
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
.antiraid-module:hover {
|
||||
border-color: var(--primary-color);
|
||||
}
|
||||
|
||||
.antiraid-module-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: var(--spacing-md);
|
||||
background: rgba(255, 255, 255, 0.02);
|
||||
cursor: pointer;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.antiraid-module-header:hover {
|
||||
background: rgba(255, 255, 255, 0.05);
|
||||
}
|
||||
|
||||
.antiraid-module-title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--spacing-sm);
|
||||
font-weight: 600;
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.antiraid-icon {
|
||||
font-size: 1.2rem;
|
||||
}
|
||||
|
||||
.antiraid-module-body {
|
||||
padding: var(--spacing-md);
|
||||
border-top: 1px solid var(--border-color);
|
||||
display: block;
|
||||
}
|
||||
|
||||
.antiraid-module-body .text-muted {
|
||||
margin-bottom: var(--spacing-md);
|
||||
}
|
||||
|
||||
.form-row {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
||||
gap: var(--spacing-md);
|
||||
}
|
||||
|
||||
.checkbox-group {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--spacing-sm);
|
||||
}
|
||||
|
||||
.checkbox-label {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--spacing-sm);
|
||||
cursor: pointer;
|
||||
color: var(--text-secondary);
|
||||
transition: color 0.2s;
|
||||
}
|
||||
|
||||
.checkbox-label:hover {
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.checkbox-label input[type="checkbox"] {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
cursor: pointer;
|
||||
accent-color: var(--primary-color);
|
||||
}
|
||||
|
||||
.multi-select {
|
||||
min-height: 80px;
|
||||
padding: var(--spacing-sm);
|
||||
}
|
||||
|
||||
.multi-select option {
|
||||
padding: var(--spacing-xs) var(--spacing-sm);
|
||||
border-radius: var(--radius-sm);
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
|
||||
.multi-select option:checked {
|
||||
background: var(--primary-color);
|
||||
color: white;
|
||||
}
|
||||
|
||||
/* Status messages */
|
||||
.status-message {
|
||||
font-size: 0.9rem;
|
||||
padding: var(--spacing-xs) var(--spacing-sm);
|
||||
border-radius: var(--radius-sm);
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.status-message.success {
|
||||
color: #57F287;
|
||||
background: rgba(87, 242, 135, 0.1);
|
||||
}
|
||||
|
||||
.status-message.error {
|
||||
color: var(--error-color);
|
||||
background: rgba(237, 66, 69, 0.1);
|
||||
}
|
||||
|
||||
@@ -78,6 +78,10 @@
|
||||
<span class="nav-item-icon">📜</span>
|
||||
Logs
|
||||
</a>
|
||||
<a class="nav-item" data-section="antiraid">
|
||||
<span class="nav-item-icon">🛡️</span>
|
||||
Anti-Raid
|
||||
</a>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
@@ -1177,6 +1181,723 @@
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- Section: Anti-Raid -->
|
||||
<section class="config-section" id="section-antiraid">
|
||||
<div class="config-card">
|
||||
<div class="config-card-header">
|
||||
<div class="config-card-title">
|
||||
<span class="icon">🛡️</span>
|
||||
<h3>Système Anti-Raid</h3>
|
||||
</div>
|
||||
<label class="toggle-switch">
|
||||
<input type="checkbox" id="antiraid-enabled">
|
||||
<span class="toggle-slider"></span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="config-card-body">
|
||||
<p class="text-muted" style="margin-bottom: 1.5rem;">
|
||||
Protégez votre serveur contre les raids, le spam et les comportements malveillants. Configurez chaque module individuellement.
|
||||
</p>
|
||||
|
||||
<!-- Salon de logs anti-raid -->
|
||||
<div class="form-group">
|
||||
<label class="form-label">📜 Salon de logs Anti-Raid</label>
|
||||
<select class="form-select" id="antiraid-log-channel">
|
||||
<option value="">Aucun (pas de logs)</option>
|
||||
</select>
|
||||
<small class="text-muted">Les actions de l'anti-raid seront envoyées dans ce salon.</small>
|
||||
</div>
|
||||
|
||||
<!-- Modules Anti-Raid -->
|
||||
<div class="antiraid-modules">
|
||||
|
||||
<!-- Anti-Link -->
|
||||
<div class="antiraid-module" id="module-antilink">
|
||||
<div class="antiraid-module-header">
|
||||
<div class="antiraid-module-title">
|
||||
<span class="antiraid-icon">🔗</span>
|
||||
<span>Anti-Link</span>
|
||||
</div>
|
||||
<label class="toggle-switch">
|
||||
<input type="checkbox" id="antilink-enabled">
|
||||
<span class="toggle-slider"></span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="antiraid-module-body">
|
||||
<p class="text-muted">Bloque les liens externes. Vous pouvez autoriser certains domaines.</p>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group">
|
||||
<label class="form-label">⚡ Action</label>
|
||||
<select class="form-select" id="antilink-action">
|
||||
<option value="delete">Supprimer le message</option>
|
||||
<option value="warn">Avertir l'utilisateur</option>
|
||||
<option value="mute">Mute temporaire</option>
|
||||
<option value="kick">Expulser</option>
|
||||
<option value="ban">Bannir</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-label">✅ Domaines autorisés</label>
|
||||
<input type="text" class="form-input" id="antilink-whitelist" placeholder="youtube.com, twitter.com">
|
||||
<small class="text-muted">Séparés par des virgules</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-label">💬 Message d'avertissement</label>
|
||||
<input type="text" class="form-input" id="antilink-warn-message" placeholder="⚠️ Les liens ne sont pas autorisés ici." value="⚠️ Les liens ne sont pas autorisés ici.">
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group">
|
||||
<label class="form-label">🚫 Salons exclus</label>
|
||||
<select class="form-select multi-select" id="antilink-exclude-channels" multiple></select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-label">👑 Rôles exclus</label>
|
||||
<select class="form-select multi-select" id="antilink-exclude-roles" multiple></select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Anti-Invite -->
|
||||
<div class="antiraid-module" id="module-antiinvite">
|
||||
<div class="antiraid-module-header">
|
||||
<div class="antiraid-module-title">
|
||||
<span class="antiraid-icon">📨</span>
|
||||
<span>Anti-Invite</span>
|
||||
</div>
|
||||
<label class="toggle-switch">
|
||||
<input type="checkbox" id="antiinvite-enabled">
|
||||
<span class="toggle-slider"></span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="antiraid-module-body">
|
||||
<p class="text-muted">Bloque les invitations Discord d'autres serveurs.</p>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group">
|
||||
<label class="form-label">⚡ Action</label>
|
||||
<select class="form-select" id="antiinvite-action">
|
||||
<option value="delete">Supprimer le message</option>
|
||||
<option value="warn">Avertir l'utilisateur</option>
|
||||
<option value="mute">Mute temporaire</option>
|
||||
<option value="kick">Expulser</option>
|
||||
<option value="ban">Bannir</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-label" style="display: flex; align-items: center; gap: 0.5rem;">
|
||||
<input type="checkbox" id="antiinvite-allow-own">
|
||||
Autoriser les invites de ce serveur
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group">
|
||||
<label class="form-label">🚫 Salons exclus</label>
|
||||
<select class="form-select multi-select" id="antiinvite-exclude-channels" multiple></select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-label">👑 Rôles exclus</label>
|
||||
<select class="form-select multi-select" id="antiinvite-exclude-roles" multiple></select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Anti-Spam -->
|
||||
<div class="antiraid-module" id="module-antispam">
|
||||
<div class="antiraid-module-header">
|
||||
<div class="antiraid-module-title">
|
||||
<span class="antiraid-icon">⚡</span>
|
||||
<span>Anti-Spam</span>
|
||||
</div>
|
||||
<label class="toggle-switch">
|
||||
<input type="checkbox" id="antispam-enabled">
|
||||
<span class="toggle-slider"></span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="antiraid-module-body">
|
||||
<p class="text-muted">Détecte les utilisateurs qui envoient trop de messages rapidement.</p>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group">
|
||||
<label class="form-label">📊 Messages max</label>
|
||||
<input type="number" class="form-input" id="antispam-max-messages" min="3" max="20" value="5">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-label">⏱️ Intervalle (secondes)</label>
|
||||
<input type="number" class="form-input" id="antispam-interval" min="1" max="30" value="5">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group">
|
||||
<label class="form-label">⚡ Action</label>
|
||||
<select class="form-select" id="antispam-action">
|
||||
<option value="delete">Supprimer les messages</option>
|
||||
<option value="mute" selected>Mute temporaire</option>
|
||||
<option value="kick">Expulser</option>
|
||||
<option value="ban">Bannir</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-label">🔇 Durée du mute (minutes)</label>
|
||||
<input type="number" class="form-input" id="antispam-mute-duration" min="1" max="1440" value="10">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group">
|
||||
<label class="form-label">🚫 Salons exclus</label>
|
||||
<select class="form-select multi-select" id="antispam-exclude-channels" multiple></select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-label">👑 Rôles exclus</label>
|
||||
<select class="form-select multi-select" id="antispam-exclude-roles" multiple></select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Anti-Duplicate -->
|
||||
<div class="antiraid-module" id="module-antidupe">
|
||||
<div class="antiraid-module-header">
|
||||
<div class="antiraid-module-title">
|
||||
<span class="antiraid-icon">📋</span>
|
||||
<span>Anti-Duplicate</span>
|
||||
</div>
|
||||
<label class="toggle-switch">
|
||||
<input type="checkbox" id="antidupe-enabled">
|
||||
<span class="toggle-slider"></span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="antiraid-module-body">
|
||||
<p class="text-muted">Bloque les utilisateurs qui répètent le même message.</p>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group">
|
||||
<label class="form-label">🔄 Répétitions max</label>
|
||||
<input type="number" class="form-input" id="antidupe-max" min="2" max="10" value="3">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-label">⏱️ Intervalle (secondes)</label>
|
||||
<input type="number" class="form-input" id="antidupe-interval" min="5" max="120" value="30">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group">
|
||||
<label class="form-label">⚡ Action</label>
|
||||
<select class="form-select" id="antidupe-action">
|
||||
<option value="delete" selected>Supprimer le message</option>
|
||||
<option value="warn">Avertir l'utilisateur</option>
|
||||
<option value="mute">Mute temporaire</option>
|
||||
<option value="kick">Expulser</option>
|
||||
<option value="ban">Bannir</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group">
|
||||
<label class="form-label">🚫 Salons exclus</label>
|
||||
<select class="form-select multi-select" id="antidupe-exclude-channels" multiple></select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-label">👑 Rôles exclus</label>
|
||||
<select class="form-select multi-select" id="antidupe-exclude-roles" multiple></select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Anti-Mention -->
|
||||
<div class="antiraid-module" id="module-antimention">
|
||||
<div class="antiraid-module-header">
|
||||
<div class="antiraid-module-title">
|
||||
<span class="antiraid-icon">📢</span>
|
||||
<span>Anti-Mass Mention</span>
|
||||
</div>
|
||||
<label class="toggle-switch">
|
||||
<input type="checkbox" id="antimention-enabled">
|
||||
<span class="toggle-slider"></span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="antiraid-module-body">
|
||||
<p class="text-muted">Bloque les messages avec trop de mentions.</p>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group">
|
||||
<label class="form-label">📊 Mentions max</label>
|
||||
<input type="number" class="form-input" id="antimention-max" min="2" max="30" value="5">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-label">⚡ Action</label>
|
||||
<select class="form-select" id="antimention-action">
|
||||
<option value="delete" selected>Supprimer le message</option>
|
||||
<option value="warn">Avertir l'utilisateur</option>
|
||||
<option value="mute">Mute temporaire</option>
|
||||
<option value="kick">Expulser</option>
|
||||
<option value="ban">Bannir</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group">
|
||||
<label class="form-label">🚫 Salons exclus</label>
|
||||
<select class="form-select multi-select" id="antimention-exclude-channels" multiple></select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-label">👑 Rôles exclus</label>
|
||||
<select class="form-select multi-select" id="antimention-exclude-roles" multiple></select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Anti-Emoji -->
|
||||
<div class="antiraid-module" id="module-antiemoji">
|
||||
<div class="antiraid-module-header">
|
||||
<div class="antiraid-module-title">
|
||||
<span class="antiraid-icon">😀</span>
|
||||
<span>Anti-Emoji Spam</span>
|
||||
</div>
|
||||
<label class="toggle-switch">
|
||||
<input type="checkbox" id="antiemoji-enabled">
|
||||
<span class="toggle-slider"></span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="antiraid-module-body">
|
||||
<p class="text-muted">Bloque les messages avec trop d'emojis.</p>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group">
|
||||
<label class="form-label">😀 Emojis max</label>
|
||||
<input type="number" class="form-input" id="antiemoji-max" min="3" max="50" value="10">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-label">⚡ Action</label>
|
||||
<select class="form-select" id="antiemoji-action">
|
||||
<option value="delete" selected>Supprimer le message</option>
|
||||
<option value="warn">Avertir l'utilisateur</option>
|
||||
<option value="mute">Mute temporaire</option>
|
||||
<option value="kick">Expulser</option>
|
||||
<option value="ban">Bannir</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group">
|
||||
<label class="form-label">🚫 Salons exclus</label>
|
||||
<select class="form-select multi-select" id="antiemoji-exclude-channels" multiple></select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-label">👑 Rôles exclus</label>
|
||||
<select class="form-select multi-select" id="antiemoji-exclude-roles" multiple></select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Anti-Caps -->
|
||||
<div class="antiraid-module" id="module-anticaps">
|
||||
<div class="antiraid-module-header">
|
||||
<div class="antiraid-module-title">
|
||||
<span class="antiraid-icon">🔠</span>
|
||||
<span>Anti-Caps</span>
|
||||
</div>
|
||||
<label class="toggle-switch">
|
||||
<input type="checkbox" id="anticaps-enabled">
|
||||
<span class="toggle-slider"></span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="antiraid-module-body">
|
||||
<p class="text-muted">Bloque les messages avec trop de MAJUSCULES.</p>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group">
|
||||
<label class="form-label">📊 % de majuscules max</label>
|
||||
<input type="number" class="form-input" id="anticaps-max-percent" min="30" max="100" value="70">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-label">📏 Longueur min (caractères)</label>
|
||||
<input type="number" class="form-input" id="anticaps-min-length" min="5" max="50" value="10">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group">
|
||||
<label class="form-label">⚡ Action</label>
|
||||
<select class="form-select" id="anticaps-action">
|
||||
<option value="delete" selected>Supprimer le message</option>
|
||||
<option value="warn">Avertir l'utilisateur</option>
|
||||
<option value="mute">Mute temporaire</option>
|
||||
<option value="kick">Expulser</option>
|
||||
<option value="ban">Bannir</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group">
|
||||
<label class="form-label">🚫 Salons exclus</label>
|
||||
<select class="form-select multi-select" id="anticaps-exclude-channels" multiple></select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-label">👑 Rôles exclus</label>
|
||||
<select class="form-select multi-select" id="anticaps-exclude-roles" multiple></select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Anti-Newline -->
|
||||
<div class="antiraid-module" id="module-antinewline">
|
||||
<div class="antiraid-module-header">
|
||||
<div class="antiraid-module-title">
|
||||
<span class="antiraid-icon">📄</span>
|
||||
<span>Anti-Newline Spam</span>
|
||||
</div>
|
||||
<label class="toggle-switch">
|
||||
<input type="checkbox" id="antinewline-enabled">
|
||||
<span class="toggle-slider"></span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="antiraid-module-body">
|
||||
<p class="text-muted">Bloque les messages avec trop de sauts de ligne.</p>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group">
|
||||
<label class="form-label">📊 Lignes max</label>
|
||||
<input type="number" class="form-input" id="antinewline-max" min="5" max="50" value="15">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-label">⚡ Action</label>
|
||||
<select class="form-select" id="antinewline-action">
|
||||
<option value="delete" selected>Supprimer le message</option>
|
||||
<option value="warn">Avertir l'utilisateur</option>
|
||||
<option value="mute">Mute temporaire</option>
|
||||
<option value="kick">Expulser</option>
|
||||
<option value="ban">Bannir</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group">
|
||||
<label class="form-label">🚫 Salons exclus</label>
|
||||
<select class="form-select multi-select" id="antinewline-exclude-channels" multiple></select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-label">👑 Rôles exclus</label>
|
||||
<select class="form-select multi-select" id="antinewline-exclude-roles" multiple></select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Anti-Bot Join -->
|
||||
<div class="antiraid-module" id="module-antibot">
|
||||
<div class="antiraid-module-header">
|
||||
<div class="antiraid-module-title">
|
||||
<span class="antiraid-icon">🤖</span>
|
||||
<span>Anti-Bot / Compte suspect</span>
|
||||
</div>
|
||||
<label class="toggle-switch">
|
||||
<input type="checkbox" id="antibot-enabled">
|
||||
<span class="toggle-slider"></span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="antiraid-module-body">
|
||||
<p class="text-muted">Détecte les comptes suspects (nouveaux comptes, sans avatar, noms suspects).</p>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group">
|
||||
<label class="form-label">📅 Âge min du compte (jours)</label>
|
||||
<input type="number" class="form-input" id="antibot-min-age" min="0" max="365" value="7">
|
||||
<small class="text-muted">0 = désactivé</small>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-label">⚡ Action</label>
|
||||
<select class="form-select" id="antibot-action">
|
||||
<option value="warn">Avertir (log uniquement)</option>
|
||||
<option value="kick" selected>Expulser</option>
|
||||
<option value="ban">Bannir</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-label">🔍 Critères de détection</label>
|
||||
<div class="checkbox-group">
|
||||
<label class="checkbox-label">
|
||||
<input type="checkbox" id="antibot-no-avatar">
|
||||
Compte sans avatar personnalisé
|
||||
</label>
|
||||
<label class="checkbox-label">
|
||||
<input type="checkbox" id="antibot-suspicious-name">
|
||||
Nom suspect (pattern de bot type "user1234")
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Anti-Mass Join -->
|
||||
<div class="antiraid-module" id="module-antimassj">
|
||||
<div class="antiraid-module-header">
|
||||
<div class="antiraid-module-title">
|
||||
<span class="antiraid-icon">👥</span>
|
||||
<span>Anti-Mass Join (Raid)</span>
|
||||
</div>
|
||||
<label class="toggle-switch">
|
||||
<input type="checkbox" id="antimassj-enabled">
|
||||
<span class="toggle-slider"></span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="antiraid-module-body">
|
||||
<p class="text-muted">Détecte quand trop de membres rejoignent en peu de temps (raid).</p>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group">
|
||||
<label class="form-label">👥 Membres max</label>
|
||||
<input type="number" class="form-input" id="antimassj-max" min="3" max="50" value="10">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-label">⏱️ Intervalle (secondes)</label>
|
||||
<input type="number" class="form-input" id="antimassj-interval" min="5" max="120" value="10">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-label">⚡ Action sur les nouveaux membres pendant le raid</label>
|
||||
<select class="form-select" id="antimassj-action">
|
||||
<option value="warn">Log uniquement</option>
|
||||
<option value="kick" selected>Expulser</option>
|
||||
<option value="ban">Bannir</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Anti-Badwords -->
|
||||
<div class="antiraid-module" id="module-antibadwords">
|
||||
<div class="antiraid-module-header">
|
||||
<div class="antiraid-module-title">
|
||||
<span class="antiraid-icon">🤬</span>
|
||||
<span>Anti-Gros Mots</span>
|
||||
</div>
|
||||
<label class="toggle-switch">
|
||||
<input type="checkbox" id="antibadwords-enabled">
|
||||
<span class="toggle-slider"></span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="antiraid-module-body">
|
||||
<p class="text-muted">Bloque les messages contenant des insultes ou gros mots.</p>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="form-label">📝 Liste des mots interdits</label>
|
||||
<textarea class="form-input" id="antibadwords-words" rows="3" placeholder="Entrez les mots interdits, un par ligne ou séparés par des virgules"></textarea>
|
||||
<small class="text-muted">Le système détecte aussi les variantes avec caractères spéciaux (ex: m3rde)</small>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group">
|
||||
<label class="form-label">⚡ Action</label>
|
||||
<select class="form-select" id="antibadwords-action">
|
||||
<option value="delete" selected>Supprimer le message</option>
|
||||
<option value="warn">Avertir l'utilisateur</option>
|
||||
<option value="mute">Mute temporaire</option>
|
||||
<option value="kick">Expulser</option>
|
||||
<option value="ban">Bannir</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-label">💬 Message d'avertissement</label>
|
||||
<input type="text" class="form-input" id="antibadwords-warn-message" placeholder="⚠️ Les insultes ne sont pas autorisées." value="⚠️ Les insultes et gros mots ne sont pas autorisés.">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group">
|
||||
<label class="form-label">🚫 Salons exclus</label>
|
||||
<select class="form-select multi-select" id="antibadwords-exclude-channels" multiple></select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-label">👑 Rôles exclus</label>
|
||||
<select class="form-select multi-select" id="antibadwords-exclude-roles" multiple></select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- Section Sanctions automatiques -->
|
||||
<div class="config-card" style="margin-top: 1.5rem;">
|
||||
<div class="config-card-header">
|
||||
<div class="config-card-title">
|
||||
<span class="icon">⚠️</span>
|
||||
<h3>Sanctions automatiques (Warns)</h3>
|
||||
</div>
|
||||
<label class="toggle-switch">
|
||||
<input type="checkbox" id="warnings-enabled">
|
||||
<span class="toggle-slider"></span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="config-card-body">
|
||||
<p class="text-muted" style="margin-bottom: 1.5rem;">
|
||||
Configurez les sanctions automatiques en fonction du nombre d'avertissements.
|
||||
</p>
|
||||
|
||||
<div class="warnings-config">
|
||||
<!-- Warn 1 -->
|
||||
<div class="warning-level">
|
||||
<div class="warning-level-header">
|
||||
<span class="warning-badge">1 Warn</span>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group">
|
||||
<label class="form-label">⚡ Action</label>
|
||||
<select class="form-select" id="warn1-action">
|
||||
<option value="none" selected>Aucune</option>
|
||||
<option value="mute">Mute</option>
|
||||
<option value="kick">Expulser</option>
|
||||
<option value="ban">Bannir</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-label">⏱️ Durée (minutes)</label>
|
||||
<input type="number" class="form-input" id="warn1-duration" min="1" max="10080" value="10">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Warn 2 -->
|
||||
<div class="warning-level">
|
||||
<div class="warning-level-header">
|
||||
<span class="warning-badge">2 Warns</span>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group">
|
||||
<label class="form-label">⚡ Action</label>
|
||||
<select class="form-select" id="warn2-action">
|
||||
<option value="none" selected>Aucune</option>
|
||||
<option value="mute">Mute</option>
|
||||
<option value="kick">Expulser</option>
|
||||
<option value="ban">Bannir</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-label">⏱️ Durée (minutes)</label>
|
||||
<input type="number" class="form-input" id="warn2-duration" min="1" max="10080" value="30">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Warn 3 -->
|
||||
<div class="warning-level">
|
||||
<div class="warning-level-header">
|
||||
<span class="warning-badge">3 Warns</span>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group">
|
||||
<label class="form-label">⚡ Action</label>
|
||||
<select class="form-select" id="warn3-action">
|
||||
<option value="none">Aucune</option>
|
||||
<option value="mute" selected>Mute</option>
|
||||
<option value="kick">Expulser</option>
|
||||
<option value="ban">Bannir</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-label">⏱️ Durée (minutes)</label>
|
||||
<input type="number" class="form-input" id="warn3-duration" min="1" max="10080" value="60">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Warn 4 -->
|
||||
<div class="warning-level">
|
||||
<div class="warning-level-header">
|
||||
<span class="warning-badge">4 Warns</span>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group">
|
||||
<label class="form-label">⚡ Action</label>
|
||||
<select class="form-select" id="warn4-action">
|
||||
<option value="none">Aucune</option>
|
||||
<option value="mute">Mute</option>
|
||||
<option value="kick" selected>Expulser</option>
|
||||
<option value="ban">Bannir</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-label">⏱️ Durée (minutes)</label>
|
||||
<input type="number" class="form-input" id="warn4-duration" min="1" max="10080" value="0" disabled>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Warn 5+ -->
|
||||
<div class="warning-level">
|
||||
<div class="warning-level-header">
|
||||
<span class="warning-badge warning-badge-danger">5+ Warns</span>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group">
|
||||
<label class="form-label">⚡ Action</label>
|
||||
<select class="form-select" id="warn5-action">
|
||||
<option value="none">Aucune</option>
|
||||
<option value="mute">Mute</option>
|
||||
<option value="kick">Expulser</option>
|
||||
<option value="ban" selected>Bannir</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-label">⏱️ Durée (minutes)</label>
|
||||
<input type="number" class="form-input" id="warn5-duration" min="1" max="10080" value="0" disabled>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Options supplémentaires -->
|
||||
<div class="form-group" style="margin-top: 1.5rem;">
|
||||
<label class="form-label">⚙️ Options</label>
|
||||
<div class="checkbox-group">
|
||||
<label class="checkbox-label">
|
||||
<input type="checkbox" id="warnings-decay-enabled">
|
||||
Expiration des warns après un certain temps
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row" id="warnings-decay-options" style="display: none;">
|
||||
<div class="form-group">
|
||||
<label class="form-label">📅 Expiration après (jours)</label>
|
||||
<input type="number" class="form-input" id="warnings-decay-days" min="1" max="365" value="30">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="form-label">📜 Salon de notifications</label>
|
||||
<select class="form-select" id="warnings-notify-channel">
|
||||
<option value="">Aucun (pas de notification)</option>
|
||||
</select>
|
||||
<small class="text-muted">Les sanctions automatiques seront notifiées dans ce salon.</small>
|
||||
</div>
|
||||
|
||||
<div class="config-card-footer" style="margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--border-color);">
|
||||
<div id="status-warnings-form" class="status-message"></div>
|
||||
<button type="button" class="btn btn-primary" id="warnings-save-btn">
|
||||
💾 Sauvegarder les sanctions
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="config-card-footer">
|
||||
<div id="status-antiraid-form" class="status-message"></div>
|
||||
<button type="button" class="btn btn-primary" id="antiraid-save-btn">
|
||||
💾 Sauvegarder
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</div>
|
||||
</main>
|
||||
|
||||
@@ -1198,5 +1919,6 @@
|
||||
<script src="/guild/sendMessageForm.js"></script>
|
||||
<script src="/guild/botAppearanceForm.js"></script>
|
||||
<script src="/guild/logsForm.js"></script>
|
||||
<script src="/guild/antiraidForm.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -0,0 +1,480 @@
|
||||
// =============================================
|
||||
// ========== ANTI-RAID FORM ===================
|
||||
// =============================================
|
||||
|
||||
(function() {
|
||||
let config = {};
|
||||
let warningsConfig = {};
|
||||
let channels = [];
|
||||
let roles = [];
|
||||
|
||||
// Charger la config anti-raid
|
||||
async function loadAntiraidConfig() {
|
||||
try {
|
||||
const res = await fetch(`/api/bot/get-antiraid-config?guildId=${guildId}`);
|
||||
const data = await res.json();
|
||||
|
||||
if (data.success) {
|
||||
config = data.config;
|
||||
channels = data.channels || [];
|
||||
roles = data.roles || [];
|
||||
|
||||
populateSelects();
|
||||
fillForm();
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('Erreur chargement config antiraid:', err);
|
||||
}
|
||||
|
||||
// Charger aussi la config des warnings
|
||||
try {
|
||||
const res = await fetch(`/api/bot/get-warnings-config?guildId=${guildId}`);
|
||||
const data = await res.json();
|
||||
|
||||
if (data.success) {
|
||||
warningsConfig = data.config;
|
||||
fillWarningsForm();
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('Erreur chargement config warnings:', err);
|
||||
}
|
||||
}
|
||||
|
||||
// Remplir les selects avec les salons et rôles
|
||||
function populateSelects() {
|
||||
// Salon de logs
|
||||
const logChannelSelect = document.getElementById('antiraid-log-channel');
|
||||
logChannelSelect.innerHTML = '<option value="">Aucun (pas de logs)</option>';
|
||||
channels.forEach(ch => {
|
||||
logChannelSelect.innerHTML += `<option value="${ch.id}"># ${ch.name}</option>`;
|
||||
});
|
||||
|
||||
// Salon notifications warnings
|
||||
const notifyChannelSelect = document.getElementById('warnings-notify-channel');
|
||||
if (notifyChannelSelect) {
|
||||
notifyChannelSelect.innerHTML = '<option value="">Aucun (pas de notification)</option>';
|
||||
channels.forEach(ch => {
|
||||
notifyChannelSelect.innerHTML += `<option value="${ch.id}"># ${ch.name}</option>`;
|
||||
});
|
||||
}
|
||||
|
||||
// Multi-selects pour les exclusions
|
||||
const channelSelects = [
|
||||
'antilink-exclude-channels',
|
||||
'antiinvite-exclude-channels',
|
||||
'antispam-exclude-channels',
|
||||
'antidupe-exclude-channels',
|
||||
'antimention-exclude-channels',
|
||||
'antiemoji-exclude-channels',
|
||||
'anticaps-exclude-channels',
|
||||
'antinewline-exclude-channels',
|
||||
'antibadwords-exclude-channels'
|
||||
];
|
||||
|
||||
const roleSelects = [
|
||||
'antilink-exclude-roles',
|
||||
'antiinvite-exclude-roles',
|
||||
'antispam-exclude-roles',
|
||||
'antidupe-exclude-roles',
|
||||
'antimention-exclude-roles',
|
||||
'antiemoji-exclude-roles',
|
||||
'anticaps-exclude-roles',
|
||||
'antinewline-exclude-roles',
|
||||
'antibadwords-exclude-roles'
|
||||
];
|
||||
|
||||
channelSelects.forEach(selectId => {
|
||||
const select = document.getElementById(selectId);
|
||||
if (select) {
|
||||
select.innerHTML = '';
|
||||
channels.forEach(ch => {
|
||||
select.innerHTML += `<option value="${ch.id}"># ${ch.name}</option>`;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
roleSelects.forEach(selectId => {
|
||||
const select = document.getElementById(selectId);
|
||||
if (select) {
|
||||
select.innerHTML = '';
|
||||
roles.forEach(r => {
|
||||
select.innerHTML += `<option value="${r.id}" style="color: ${r.color}">@ ${r.name}</option>`;
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Remplir le formulaire avec la config
|
||||
function fillForm() {
|
||||
// Global
|
||||
document.getElementById('antiraid-enabled').checked = config.enabled;
|
||||
document.getElementById('antiraid-log-channel').value = config.log_channel_id || '';
|
||||
|
||||
// Anti-Link
|
||||
document.getElementById('antilink-enabled').checked = config.antilink_enabled;
|
||||
document.getElementById('antilink-action').value = config.antilink_action || 'delete';
|
||||
document.getElementById('antilink-warn-message').value = config.antilink_warn_message || '⚠️ Les liens ne sont pas autorisés ici.';
|
||||
try {
|
||||
const whitelist = JSON.parse(config.antilink_whitelist_domains || '[]');
|
||||
document.getElementById('antilink-whitelist').value = whitelist.join(', ');
|
||||
} catch { document.getElementById('antilink-whitelist').value = ''; }
|
||||
setMultiSelectValues('antilink-exclude-channels', config.antilink_exclude_channels);
|
||||
setMultiSelectValues('antilink-exclude-roles', config.antilink_exclude_roles);
|
||||
|
||||
// Anti-Invite
|
||||
document.getElementById('antiinvite-enabled').checked = config.antiinvite_enabled;
|
||||
document.getElementById('antiinvite-action').value = config.antiinvite_action || 'delete';
|
||||
document.getElementById('antiinvite-allow-own').checked = config.antiinvite_allow_own_server;
|
||||
setMultiSelectValues('antiinvite-exclude-channels', config.antiinvite_exclude_channels);
|
||||
setMultiSelectValues('antiinvite-exclude-roles', config.antiinvite_exclude_roles);
|
||||
|
||||
// Anti-Spam
|
||||
document.getElementById('antispam-enabled').checked = config.antispam_enabled;
|
||||
document.getElementById('antispam-max-messages').value = config.antispam_max_messages || 5;
|
||||
document.getElementById('antispam-interval').value = config.antispam_interval_seconds || 5;
|
||||
document.getElementById('antispam-action').value = config.antispam_action || 'mute';
|
||||
document.getElementById('antispam-mute-duration').value = config.antispam_mute_duration_minutes || 10;
|
||||
setMultiSelectValues('antispam-exclude-channels', config.antispam_exclude_channels);
|
||||
setMultiSelectValues('antispam-exclude-roles', config.antispam_exclude_roles);
|
||||
|
||||
// Anti-Duplicate
|
||||
document.getElementById('antidupe-enabled').checked = config.antidupe_enabled;
|
||||
document.getElementById('antidupe-max').value = config.antidupe_max_duplicates || 3;
|
||||
document.getElementById('antidupe-interval').value = config.antidupe_interval_seconds || 30;
|
||||
document.getElementById('antidupe-action').value = config.antidupe_action || 'delete';
|
||||
setMultiSelectValues('antidupe-exclude-channels', config.antidupe_exclude_channels);
|
||||
setMultiSelectValues('antidupe-exclude-roles', config.antidupe_exclude_roles);
|
||||
|
||||
// Anti-Mention
|
||||
document.getElementById('antimention-enabled').checked = config.antimention_enabled;
|
||||
document.getElementById('antimention-max').value = config.antimention_max_mentions || 5;
|
||||
document.getElementById('antimention-action').value = config.antimention_action || 'delete';
|
||||
setMultiSelectValues('antimention-exclude-channels', config.antimention_exclude_channels);
|
||||
setMultiSelectValues('antimention-exclude-roles', config.antimention_exclude_roles);
|
||||
|
||||
// Anti-Emoji
|
||||
document.getElementById('antiemoji-enabled').checked = config.antiemoji_enabled;
|
||||
document.getElementById('antiemoji-max').value = config.antiemoji_max_emojis || 10;
|
||||
document.getElementById('antiemoji-action').value = config.antiemoji_action || 'delete';
|
||||
setMultiSelectValues('antiemoji-exclude-channels', config.antiemoji_exclude_channels);
|
||||
setMultiSelectValues('antiemoji-exclude-roles', config.antiemoji_exclude_roles);
|
||||
|
||||
// Anti-Caps
|
||||
document.getElementById('anticaps-enabled').checked = config.anticaps_enabled;
|
||||
document.getElementById('anticaps-max-percent').value = config.anticaps_max_percent || 70;
|
||||
document.getElementById('anticaps-min-length').value = config.anticaps_min_length || 10;
|
||||
document.getElementById('anticaps-action').value = config.anticaps_action || 'delete';
|
||||
setMultiSelectValues('anticaps-exclude-channels', config.anticaps_exclude_channels);
|
||||
setMultiSelectValues('anticaps-exclude-roles', config.anticaps_exclude_roles);
|
||||
|
||||
// Anti-Newline
|
||||
document.getElementById('antinewline-enabled').checked = config.antinewline_enabled;
|
||||
document.getElementById('antinewline-max').value = config.antinewline_max_lines || 15;
|
||||
document.getElementById('antinewline-action').value = config.antinewline_action || 'delete';
|
||||
setMultiSelectValues('antinewline-exclude-channels', config.antinewline_exclude_channels);
|
||||
setMultiSelectValues('antinewline-exclude-roles', config.antinewline_exclude_roles);
|
||||
|
||||
// Anti-Bot
|
||||
document.getElementById('antibot-enabled').checked = config.antibot_enabled;
|
||||
document.getElementById('antibot-min-age').value = config.antibot_min_account_age_days || 7;
|
||||
document.getElementById('antibot-action').value = config.antibot_action || 'kick';
|
||||
document.getElementById('antibot-no-avatar').checked = config.antibot_no_avatar_action;
|
||||
document.getElementById('antibot-suspicious-name').checked = config.antibot_suspicious_name_action;
|
||||
|
||||
// Anti-Mass Join
|
||||
document.getElementById('antimassj-enabled').checked = config.antimassj_enabled;
|
||||
document.getElementById('antimassj-max').value = config.antimassj_max_joins || 10;
|
||||
document.getElementById('antimassj-interval').value = config.antimassj_interval_seconds || 10;
|
||||
document.getElementById('antimassj-action').value = config.antimassj_action || 'kick';
|
||||
|
||||
// Anti-Badwords
|
||||
document.getElementById('antibadwords-enabled').checked = config.antibadwords_enabled;
|
||||
document.getElementById('antibadwords-action').value = config.antibadwords_action || 'delete';
|
||||
document.getElementById('antibadwords-warn-message').value = config.antibadwords_warn_message || '⚠️ Les insultes et gros mots ne sont pas autorisés.';
|
||||
try {
|
||||
const words = JSON.parse(config.antibadwords_words || '[]');
|
||||
document.getElementById('antibadwords-words').value = words.join('\n');
|
||||
} catch { document.getElementById('antibadwords-words').value = ''; }
|
||||
setMultiSelectValues('antibadwords-exclude-channels', config.antibadwords_exclude_channels);
|
||||
setMultiSelectValues('antibadwords-exclude-roles', config.antibadwords_exclude_roles);
|
||||
|
||||
updateModulesVisibility();
|
||||
}
|
||||
|
||||
// Remplir le formulaire des warnings
|
||||
function fillWarningsForm() {
|
||||
document.getElementById('warnings-enabled').checked = warningsConfig.enabled;
|
||||
document.getElementById('warn1-action').value = warningsConfig.warn1_action || 'none';
|
||||
document.getElementById('warn1-duration').value = warningsConfig.warn1_duration || 10;
|
||||
document.getElementById('warn2-action').value = warningsConfig.warn2_action || 'none';
|
||||
document.getElementById('warn2-duration').value = warningsConfig.warn2_duration || 30;
|
||||
document.getElementById('warn3-action').value = warningsConfig.warn3_action || 'mute';
|
||||
document.getElementById('warn3-duration').value = warningsConfig.warn3_duration || 60;
|
||||
document.getElementById('warn4-action').value = warningsConfig.warn4_action || 'kick';
|
||||
document.getElementById('warn4-duration').value = warningsConfig.warn4_duration || 0;
|
||||
document.getElementById('warn5-action').value = warningsConfig.warn5_action || 'ban';
|
||||
document.getElementById('warn5-duration').value = warningsConfig.warn5_duration || 0;
|
||||
document.getElementById('warnings-decay-enabled').checked = warningsConfig.decay_enabled;
|
||||
document.getElementById('warnings-decay-days').value = warningsConfig.decay_days || 30;
|
||||
document.getElementById('warnings-notify-channel').value = warningsConfig.notify_channel_id || '';
|
||||
|
||||
// Afficher/masquer les options de decay
|
||||
document.getElementById('warnings-decay-options').style.display =
|
||||
warningsConfig.decay_enabled ? 'grid' : 'none';
|
||||
|
||||
updateWarningDurationFields();
|
||||
}
|
||||
|
||||
// Mettre à jour les champs de durée selon l'action
|
||||
function updateWarningDurationFields() {
|
||||
for (let i = 1; i <= 5; i++) {
|
||||
const action = document.getElementById(`warn${i}-action`).value;
|
||||
const durationField = document.getElementById(`warn${i}-duration`);
|
||||
durationField.disabled = action !== 'mute';
|
||||
}
|
||||
}
|
||||
|
||||
// Helper pour les multi-selects
|
||||
function setMultiSelectValues(selectId, jsonValue) {
|
||||
const select = document.getElementById(selectId);
|
||||
if (!select) return;
|
||||
|
||||
try {
|
||||
const values = JSON.parse(jsonValue || '[]');
|
||||
Array.from(select.options).forEach(opt => {
|
||||
opt.selected = values.includes(opt.value);
|
||||
});
|
||||
} catch {}
|
||||
}
|
||||
|
||||
function getMultiSelectValues(selectId) {
|
||||
const select = document.getElementById(selectId);
|
||||
if (!select) return [];
|
||||
return Array.from(select.selectedOptions).map(opt => opt.value);
|
||||
}
|
||||
|
||||
// Mise à jour de la visibilité des modules selon l'état global
|
||||
function updateModulesVisibility() {
|
||||
const enabled = document.getElementById('antiraid-enabled').checked;
|
||||
const modules = document.querySelectorAll('.antiraid-module');
|
||||
modules.forEach(m => {
|
||||
m.style.opacity = enabled ? '1' : '0.5';
|
||||
m.style.pointerEvents = enabled ? 'auto' : 'none';
|
||||
});
|
||||
}
|
||||
|
||||
// Sauvegarder la config
|
||||
async function saveAntiraidConfig() {
|
||||
const statusEl = document.getElementById('status-antiraid-form');
|
||||
const saveBtn = document.getElementById('antiraid-save-btn');
|
||||
|
||||
saveBtn.disabled = true;
|
||||
statusEl.textContent = 'Sauvegarde en cours...';
|
||||
statusEl.className = 'status-message';
|
||||
|
||||
// Parser la whitelist
|
||||
const whitelistText = document.getElementById('antilink-whitelist').value;
|
||||
const whitelist = whitelistText.split(',').map(d => d.trim()).filter(d => d);
|
||||
|
||||
const configData = {
|
||||
enabled: document.getElementById('antiraid-enabled').checked,
|
||||
log_channel_id: document.getElementById('antiraid-log-channel').value || null,
|
||||
|
||||
// Anti-Link
|
||||
antilink_enabled: document.getElementById('antilink-enabled').checked,
|
||||
antilink_action: document.getElementById('antilink-action').value,
|
||||
antilink_whitelist_domains: whitelist,
|
||||
antilink_exclude_channels: getMultiSelectValues('antilink-exclude-channels'),
|
||||
antilink_exclude_roles: getMultiSelectValues('antilink-exclude-roles'),
|
||||
antilink_warn_message: document.getElementById('antilink-warn-message').value,
|
||||
|
||||
// Anti-Invite
|
||||
antiinvite_enabled: document.getElementById('antiinvite-enabled').checked,
|
||||
antiinvite_action: document.getElementById('antiinvite-action').value,
|
||||
antiinvite_allow_own_server: document.getElementById('antiinvite-allow-own').checked,
|
||||
antiinvite_exclude_channels: getMultiSelectValues('antiinvite-exclude-channels'),
|
||||
antiinvite_exclude_roles: getMultiSelectValues('antiinvite-exclude-roles'),
|
||||
|
||||
// Anti-Spam
|
||||
antispam_enabled: document.getElementById('antispam-enabled').checked,
|
||||
antispam_max_messages: parseInt(document.getElementById('antispam-max-messages').value) || 5,
|
||||
antispam_interval_seconds: parseInt(document.getElementById('antispam-interval').value) || 5,
|
||||
antispam_action: document.getElementById('antispam-action').value,
|
||||
antispam_mute_duration_minutes: parseInt(document.getElementById('antispam-mute-duration').value) || 10,
|
||||
antispam_exclude_channels: getMultiSelectValues('antispam-exclude-channels'),
|
||||
antispam_exclude_roles: getMultiSelectValues('antispam-exclude-roles'),
|
||||
|
||||
// Anti-Duplicate
|
||||
antidupe_enabled: document.getElementById('antidupe-enabled').checked,
|
||||
antidupe_max_duplicates: parseInt(document.getElementById('antidupe-max').value) || 3,
|
||||
antidupe_interval_seconds: parseInt(document.getElementById('antidupe-interval').value) || 30,
|
||||
antidupe_action: document.getElementById('antidupe-action').value,
|
||||
antidupe_exclude_channels: getMultiSelectValues('antidupe-exclude-channels'),
|
||||
antidupe_exclude_roles: getMultiSelectValues('antidupe-exclude-roles'),
|
||||
|
||||
// Anti-Mention
|
||||
antimention_enabled: document.getElementById('antimention-enabled').checked,
|
||||
antimention_max_mentions: parseInt(document.getElementById('antimention-max').value) || 5,
|
||||
antimention_action: document.getElementById('antimention-action').value,
|
||||
antimention_exclude_channels: getMultiSelectValues('antimention-exclude-channels'),
|
||||
antimention_exclude_roles: getMultiSelectValues('antimention-exclude-roles'),
|
||||
|
||||
// Anti-Emoji
|
||||
antiemoji_enabled: document.getElementById('antiemoji-enabled').checked,
|
||||
antiemoji_max_emojis: parseInt(document.getElementById('antiemoji-max').value) || 10,
|
||||
antiemoji_action: document.getElementById('antiemoji-action').value,
|
||||
antiemoji_exclude_channels: getMultiSelectValues('antiemoji-exclude-channels'),
|
||||
antiemoji_exclude_roles: getMultiSelectValues('antiemoji-exclude-roles'),
|
||||
|
||||
// Anti-Caps
|
||||
anticaps_enabled: document.getElementById('anticaps-enabled').checked,
|
||||
anticaps_max_percent: parseInt(document.getElementById('anticaps-max-percent').value) || 70,
|
||||
anticaps_min_length: parseInt(document.getElementById('anticaps-min-length').value) || 10,
|
||||
anticaps_action: document.getElementById('anticaps-action').value,
|
||||
anticaps_exclude_channels: getMultiSelectValues('anticaps-exclude-channels'),
|
||||
anticaps_exclude_roles: getMultiSelectValues('anticaps-exclude-roles'),
|
||||
|
||||
// Anti-Newline
|
||||
antinewline_enabled: document.getElementById('antinewline-enabled').checked,
|
||||
antinewline_max_lines: parseInt(document.getElementById('antinewline-max').value) || 15,
|
||||
antinewline_action: document.getElementById('antinewline-action').value,
|
||||
antinewline_exclude_channels: getMultiSelectValues('antinewline-exclude-channels'),
|
||||
antinewline_exclude_roles: getMultiSelectValues('antinewline-exclude-roles'),
|
||||
|
||||
// Anti-Bot
|
||||
antibot_enabled: document.getElementById('antibot-enabled').checked,
|
||||
antibot_min_account_age_days: parseInt(document.getElementById('antibot-min-age').value) || 7,
|
||||
antibot_no_avatar_action: document.getElementById('antibot-no-avatar').checked,
|
||||
antibot_suspicious_name_action: document.getElementById('antibot-suspicious-name').checked,
|
||||
antibot_action: document.getElementById('antibot-action').value,
|
||||
|
||||
// Anti-Mass Join
|
||||
antimassj_enabled: document.getElementById('antimassj-enabled').checked,
|
||||
antimassj_max_joins: parseInt(document.getElementById('antimassj-max').value) || 10,
|
||||
antimassj_interval_seconds: parseInt(document.getElementById('antimassj-interval').value) || 10,
|
||||
antimassj_action: document.getElementById('antimassj-action').value,
|
||||
|
||||
// Anti-Badwords
|
||||
antibadwords_enabled: document.getElementById('antibadwords-enabled').checked,
|
||||
antibadwords_words: document.getElementById('antibadwords-words').value.split('\n').map(w => w.trim()).filter(w => w),
|
||||
antibadwords_action: document.getElementById('antibadwords-action').value,
|
||||
antibadwords_warn_message: document.getElementById('antibadwords-warn-message').value,
|
||||
antibadwords_exclude_channels: getMultiSelectValues('antibadwords-exclude-channels'),
|
||||
antibadwords_exclude_roles: getMultiSelectValues('antibadwords-exclude-roles')
|
||||
};
|
||||
|
||||
try {
|
||||
const res = await fetch('/api/bot/save-antiraid-config', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ guildId, config: configData })
|
||||
});
|
||||
|
||||
const data = await res.json();
|
||||
|
||||
if (data.success) {
|
||||
statusEl.textContent = '✅ Configuration sauvegardée !';
|
||||
statusEl.className = 'status-message success';
|
||||
} else {
|
||||
statusEl.textContent = '❌ ' + (data.error || 'Erreur inconnue');
|
||||
statusEl.className = 'status-message error';
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('Erreur sauvegarde antiraid:', err);
|
||||
statusEl.textContent = '❌ Erreur de connexion';
|
||||
statusEl.className = 'status-message error';
|
||||
}
|
||||
|
||||
saveBtn.disabled = false;
|
||||
setTimeout(() => {
|
||||
statusEl.textContent = '';
|
||||
statusEl.className = 'status-message';
|
||||
}, 3000);
|
||||
}
|
||||
|
||||
// Event Listeners
|
||||
document.getElementById('antiraid-enabled').addEventListener('change', updateModulesVisibility);
|
||||
document.getElementById('antiraid-save-btn').addEventListener('click', saveAntiraidConfig);
|
||||
|
||||
// Warnings event listeners
|
||||
document.getElementById('warnings-decay-enabled').addEventListener('change', (e) => {
|
||||
document.getElementById('warnings-decay-options').style.display = e.target.checked ? 'grid' : 'none';
|
||||
});
|
||||
|
||||
// Update duration fields when action changes
|
||||
for (let i = 1; i <= 5; i++) {
|
||||
document.getElementById(`warn${i}-action`).addEventListener('change', updateWarningDurationFields);
|
||||
}
|
||||
|
||||
document.getElementById('warnings-save-btn').addEventListener('click', saveWarningsConfig);
|
||||
|
||||
// Sauvegarder la config warnings
|
||||
async function saveWarningsConfig() {
|
||||
const statusEl = document.getElementById('status-warnings-form');
|
||||
const saveBtn = document.getElementById('warnings-save-btn');
|
||||
|
||||
saveBtn.disabled = true;
|
||||
statusEl.textContent = 'Sauvegarde en cours...';
|
||||
statusEl.className = 'status-message';
|
||||
|
||||
const configData = {
|
||||
enabled: document.getElementById('warnings-enabled').checked,
|
||||
warn1_action: document.getElementById('warn1-action').value,
|
||||
warn1_duration: parseInt(document.getElementById('warn1-duration').value) || 10,
|
||||
warn2_action: document.getElementById('warn2-action').value,
|
||||
warn2_duration: parseInt(document.getElementById('warn2-duration').value) || 30,
|
||||
warn3_action: document.getElementById('warn3-action').value,
|
||||
warn3_duration: parseInt(document.getElementById('warn3-duration').value) || 60,
|
||||
warn4_action: document.getElementById('warn4-action').value,
|
||||
warn4_duration: parseInt(document.getElementById('warn4-duration').value) || 0,
|
||||
warn5_action: document.getElementById('warn5-action').value,
|
||||
warn5_duration: parseInt(document.getElementById('warn5-duration').value) || 0,
|
||||
decay_enabled: document.getElementById('warnings-decay-enabled').checked,
|
||||
decay_days: parseInt(document.getElementById('warnings-decay-days').value) || 30,
|
||||
notify_channel_id: document.getElementById('warnings-notify-channel').value || null
|
||||
};
|
||||
|
||||
try {
|
||||
const res = await fetch('/api/bot/save-warnings-config', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ guildId, config: configData })
|
||||
});
|
||||
|
||||
const data = await res.json();
|
||||
|
||||
if (data.success) {
|
||||
statusEl.textContent = '✅ Configuration sauvegardée !';
|
||||
statusEl.className = 'status-message success';
|
||||
} else {
|
||||
statusEl.textContent = '❌ ' + (data.error || 'Erreur inconnue');
|
||||
statusEl.className = 'status-message error';
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('Erreur sauvegarde warnings:', err);
|
||||
statusEl.textContent = '❌ Erreur de connexion';
|
||||
statusEl.className = 'status-message error';
|
||||
}
|
||||
|
||||
saveBtn.disabled = false;
|
||||
setTimeout(() => {
|
||||
statusEl.textContent = '';
|
||||
statusEl.className = 'status-message';
|
||||
}, 3000);
|
||||
}
|
||||
|
||||
// Toggle modules body visibility when clicking header
|
||||
document.querySelectorAll('.antiraid-module-header').forEach(header => {
|
||||
header.addEventListener('click', (e) => {
|
||||
// Ne pas toggle si on clique sur le switch
|
||||
if (e.target.closest('.toggle-switch')) return;
|
||||
|
||||
const module = header.closest('.antiraid-module');
|
||||
const body = module.querySelector('.antiraid-module-body');
|
||||
body.style.display = body.style.display === 'none' ? 'block' : 'none';
|
||||
});
|
||||
});
|
||||
|
||||
// Charger au démarrage
|
||||
loadAntiraidConfig();
|
||||
})();
|
||||
Reference in New Issue
Block a user