477 lines
19 KiB
HTML
477 lines
19 KiB
HTML
{% extends "template.html" %}
|
|
|
|
{% block content %}
|
|
<div class="config-page">
|
|
<h1>⚙️ Configuration</h1>
|
|
<p>Paramétrez Discord, Twitch, YouTube et les fonctionnalités du bot.</p>
|
|
|
|
<!-- Section Discord -->
|
|
<div class="config-section open" data-section="discord">
|
|
<div class="config-section-header" onclick="toggleSection(this)">
|
|
<div class="config-section-icon">🎮</div>
|
|
<div class="config-section-title">
|
|
<h2>Discord</h2>
|
|
<p>Token API, messages de bienvenue, auto-rôle et modération</p>
|
|
</div>
|
|
<svg class="config-section-chevron" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
<path d="M6 9l6 6 6-6"/>
|
|
</svg>
|
|
</div>
|
|
<div class="config-section-content">
|
|
<form action="{{ url_for('updateConfiguration') }}" method="POST">
|
|
|
|
<!-- Token Discord -->
|
|
<div class="config-card">
|
|
<div class="config-card-header">
|
|
<h3>🔑 Token Discord</h3>
|
|
<span class="badge">Sensible</span>
|
|
</div>
|
|
<label for="discord_token">Token du bot (caché)</label>
|
|
<div class="token-input-wrapper">
|
|
<input name="discord_token" id="discord_token" type="password" placeholder="Votre token Discord" autocomplete="off" />
|
|
<button type="button" class="token-toggle" onclick="toggleTokenVisibility('discord_token', this)" title="Afficher/Masquer">👁️</button>
|
|
</div>
|
|
<small>⚠️ Nécessite un redémarrage du bot après modification</small>
|
|
</div>
|
|
|
|
<!-- Messages de bienvenue -->
|
|
<div class="config-card">
|
|
<div class="config-card-header">
|
|
<h3>👋 Messages de bienvenue</h3>
|
|
</div>
|
|
|
|
<div class="toggle-row">
|
|
<label for="welcome_enable">Activer le message de bienvenue pour les nouveaux membres</label>
|
|
<div class="toggle-switch">
|
|
<input type="checkbox" name="welcome_enable" id="welcome_enable" {% if configuration.getValue('welcome_enable') %}checked{% endif %}>
|
|
<span class="toggle-slider"></span>
|
|
</div>
|
|
</div>
|
|
|
|
<label for="welcome_channel_id">Canal de bienvenue</label>
|
|
<select name="welcome_channel_id" id="welcome_channel_id">
|
|
{% for channel in channels %}
|
|
<option value="{{channel.id}}" {% if configuration.getIntValue('welcome_channel_id')==channel.id %}selected{% endif %}>
|
|
#{{channel.name}}
|
|
</option>
|
|
{% endfor %}
|
|
</select>
|
|
|
|
<label for="welcome_message">Message personnalisé</label>
|
|
<textarea name="welcome_message" id="welcome_message" rows="3" placeholder="Bienvenue {member.mention} sur le serveur !">{{ configuration.getValue('welcome_message') }}</textarea>
|
|
|
|
<details class="syntax-helper">
|
|
<summary>📝 Variables disponibles</summary>
|
|
<div class="syntax-list">
|
|
<div class="syntax-item">
|
|
<code>{member.mention}</code>
|
|
<span>Mentionne l'utilisateur (@NomUtilisateur)</span>
|
|
</div>
|
|
<div class="syntax-item">
|
|
<code>{member.name}</code>
|
|
<span>Nom d'utilisateur (sans mention)</span>
|
|
</div>
|
|
<div class="syntax-item">
|
|
<code>{member.display_name}</code>
|
|
<span>Surnom sur le serveur</span>
|
|
</div>
|
|
<div class="syntax-item">
|
|
<code>{member.id}</code>
|
|
<span>ID de l'utilisateur</span>
|
|
</div>
|
|
<div class="syntax-item">
|
|
<code>{server.name}</code>
|
|
<span>Nom du serveur</span>
|
|
</div>
|
|
<div class="syntax-item">
|
|
<code>{server.member_count}</code>
|
|
<span>Nombre total de membres</span>
|
|
</div>
|
|
<div class="syntax-item">
|
|
<code><#ID_DU_CHANNEL></code>
|
|
<span>Mentionne un salon</span>
|
|
</div>
|
|
</div>
|
|
</details>
|
|
</div>
|
|
|
|
<!-- Auto-Role -->
|
|
<div class="config-card">
|
|
<div class="config-card-header">
|
|
<h3>🎭 Auto-Rôle</h3>
|
|
</div>
|
|
|
|
<div class="toggle-row">
|
|
<label for="autorole_enable">Attribuer automatiquement un rôle aux nouveaux membres</label>
|
|
<div class="toggle-switch">
|
|
<input type="checkbox" name="autorole_enable" id="autorole_enable" {% if configuration.getValue('autorole_enable') %}checked{% endif %}>
|
|
<span class="toggle-slider"></span>
|
|
</div>
|
|
</div>
|
|
|
|
<label>Rôle à attribuer</label>
|
|
{% if roles|length > 1 %}
|
|
<div class="guild-tabs">
|
|
{% for guild_data in roles %}
|
|
<button type="button" class="guild-tab {% if loop.first %}active{% endif %}" onclick="switchGuildTab(this, 'autorole-guild-{{guild_data.guild_id}}')">
|
|
{{ guild_data.guild_name }}
|
|
</button>
|
|
{% endfor %}
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% for guild_data in roles %}
|
|
<div id="autorole-guild-{{guild_data.guild_id}}" class="guild-content {% if loop.first %}active{% endif %}">
|
|
<select name="autorole_role_id">
|
|
<option value="">-- Aucun rôle --</option>
|
|
{% for role in guild_data.roles %}
|
|
<option value="{{role.id}}" {% if configuration.getIntValue('autorole_role_id')==role.id %}selected{% endif %}>
|
|
{% if role.color.value != 0 %}⬤{% else %}○{% endif %} {{role.name}}
|
|
</option>
|
|
{% endfor %}
|
|
</select>
|
|
</div>
|
|
{% endfor %}
|
|
|
|
<div class="warning-box">
|
|
<span class="warning-box-icon">⚠️</span>
|
|
<div class="warning-box-content">
|
|
<strong>Permissions requises</strong>
|
|
<p>Le bot doit avoir "Gérer les rôles" et son rôle doit être plus haut dans la hiérarchie que le rôle à attribuer.</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Messages de départ -->
|
|
<div class="config-card">
|
|
<div class="config-card-header">
|
|
<h3>🚪 Messages de départ</h3>
|
|
</div>
|
|
|
|
<div class="toggle-row">
|
|
<label for="leave_enable">Activer le message quand un membre quitte le serveur</label>
|
|
<div class="toggle-switch">
|
|
<input type="checkbox" name="leave_enable" id="leave_enable" {% if configuration.getValue('leave_enable') %}checked{% endif %}>
|
|
<span class="toggle-slider"></span>
|
|
</div>
|
|
</div>
|
|
|
|
<label for="leave_channel_id">Canal de départ</label>
|
|
<select name="leave_channel_id" id="leave_channel_id">
|
|
{% for channel in channels %}
|
|
<option value="{{channel.id}}" {% if configuration.getIntValue('leave_channel_id')==channel.id %}selected{% endif %}>
|
|
#{{channel.name}}
|
|
</option>
|
|
{% endfor %}
|
|
</select>
|
|
|
|
<label for="leave_message">Message personnalisé</label>
|
|
<textarea name="leave_message" id="leave_message" rows="3" placeholder="{member.name} a quitté le serveur.">{{ configuration.getValue('leave_message') }}</textarea>
|
|
|
|
<details class="syntax-helper">
|
|
<summary>📝 Variables disponibles</summary>
|
|
<div class="syntax-list">
|
|
<div class="syntax-item">
|
|
<code>{member.mention}</code>
|
|
<span>Mentionne l'utilisateur</span>
|
|
</div>
|
|
<div class="syntax-item">
|
|
<code>{member.name}</code>
|
|
<span>Nom d'utilisateur</span>
|
|
</div>
|
|
<div class="syntax-item">
|
|
<code>{member.display_name}</code>
|
|
<span>Surnom sur le serveur</span>
|
|
</div>
|
|
<div class="syntax-item">
|
|
<code>{server.name}</code>
|
|
<span>Nom du serveur</span>
|
|
</div>
|
|
<div class="syntax-item">
|
|
<code>{server.member_count}</code>
|
|
<span>Nombre de membres restants</span>
|
|
</div>
|
|
</div>
|
|
</details>
|
|
</div>
|
|
|
|
<!-- Modération -->
|
|
<div class="config-card">
|
|
<div class="config-card-header">
|
|
<h3>🛡️ Modération</h3>
|
|
</div>
|
|
|
|
<div class="toggle-row">
|
|
<label for="moderation_enable">Activer les commandes d'avertissement (!warn, !unwarn, !inspect)</label>
|
|
<div class="toggle-switch">
|
|
<input type="checkbox" name="moderation_enable" id="moderation_enable" {% if configuration.getValue('moderation_enable') %}checked{% endif %}>
|
|
<span class="toggle-slider"></span>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="toggle-row">
|
|
<label for="moderation_ban_enable">Activer les commandes de bannissement (!ban, !unban)</label>
|
|
<div class="toggle-switch">
|
|
<input type="checkbox" name="moderation_ban_enable" id="moderation_ban_enable" {% if configuration.getValue('moderation_ban_enable') %}checked{% endif %}>
|
|
<span class="toggle-slider"></span>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="toggle-row">
|
|
<label for="moderation_kick_enable">Activer la commande d'expulsion (!kick)</label>
|
|
<div class="toggle-switch">
|
|
<input type="checkbox" name="moderation_kick_enable" id="moderation_kick_enable" {% if configuration.getValue('moderation_kick_enable') %}checked{% endif %}>
|
|
<span class="toggle-slider"></span>
|
|
</div>
|
|
</div>
|
|
|
|
<label for="moderation_log_channel_id">Canal de logs de modération</label>
|
|
<select name="moderation_log_channel_id" id="moderation_log_channel_id">
|
|
{% for channel in channels %}
|
|
<option value="{{channel.id}}" {% if configuration.getIntValue('moderation_log_channel_id')==channel.id %}selected{% endif %}>
|
|
#{{channel.name}}
|
|
</option>
|
|
{% endfor %}
|
|
</select>
|
|
<small>Toutes les actions de modération seront notifiées dans ce canal</small>
|
|
|
|
<label>Rôles Staff autorisés</label>
|
|
{% set selected_roles = (configuration.getValue('moderation_staff_role_ids') or '').split(',') %}
|
|
|
|
{% if roles|length > 1 %}
|
|
<div class="guild-tabs">
|
|
{% for guild_data in roles %}
|
|
<button type="button" class="guild-tab {% if loop.first %}active{% endif %}" onclick="switchGuildTab(this, 'moderation-guild-{{guild_data.guild_id}}')">
|
|
{{ guild_data.guild_name }}
|
|
</button>
|
|
{% endfor %}
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% for guild_data in roles %}
|
|
<div id="moderation-guild-{{guild_data.guild_id}}" class="guild-content {% if loop.first %}active{% endif %}">
|
|
<div class="roles-container">
|
|
{% for role in guild_data.roles %}
|
|
<div class="role-item">
|
|
<input type="checkbox" name="moderation_staff_role_ids" id="role-{{role.id}}" value="{{role.id}}" {% if role.id|string in selected_roles %}checked{% endif %}>
|
|
<label for="role-{{role.id}}">
|
|
<span class="role-color" style="background-color: {% if role.color.value != 0 %}#{{ '%06x' % role.color.value }}{% else %}var(--text-muted){% endif %};"></span>
|
|
{{role.name}}
|
|
</label>
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
</div>
|
|
{% endfor %}
|
|
<small>Sélectionnez les rôles qui peuvent utiliser les commandes de modération</small>
|
|
|
|
<label for="moderation_embed_delete_delay">Délai de suppression des embeds (secondes)</label>
|
|
<input name="moderation_embed_delete_delay" id="moderation_embed_delete_delay" type="number" value="{{ configuration.getValue('moderation_embed_delete_delay') or '0' }}" placeholder="0" min="0" />
|
|
<small>Mettre 0 pour ne jamais supprimer automatiquement</small>
|
|
</div>
|
|
|
|
<div class="config-actions">
|
|
<input type="submit" value="💾 Enregistrer Discord">
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Section Twitch -->
|
|
<div class="config-section" data-section="twitch">
|
|
<div class="config-section-header" onclick="toggleSection(this)">
|
|
<div class="config-section-icon">📺</div>
|
|
<div class="config-section-title">
|
|
<h2>Twitch</h2>
|
|
<p>Configuration de l'API Twitch pour les alertes live</p>
|
|
</div>
|
|
<svg class="config-section-chevron" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
<path d="M6 9l6 6 6-6"/>
|
|
</svg>
|
|
</div>
|
|
<div class="config-section-content">
|
|
<form action="{{ url_for('updateConfiguration') }}" method="POST">
|
|
<label for="twitch_client_id">Client ID</label>
|
|
<input name="twitch_client_id" id="twitch_client_id" type="text" value="{{ configuration.getValue('twitch_client_id') }}" placeholder="Votre Client ID Twitch" />
|
|
|
|
<label for="twitch_client_secret">Client Secret</label>
|
|
<div class="token-input-wrapper">
|
|
<input name="twitch_client_secret" id="twitch_client_secret" type="password" value="{{ configuration.getValue('twitch_client_secret') }}" placeholder="Votre Client Secret" />
|
|
<button type="button" class="token-toggle" onclick="toggleTokenVisibility('twitch_client_secret', this)" title="Afficher/Masquer">👁️</button>
|
|
</div>
|
|
|
|
<label for="twitch_channel">Chaîne à rejoindre</label>
|
|
<input name="twitch_channel" id="twitch_channel" type="text" value="{{ configuration.getValue('twitch_channel') }}" placeholder="#votre_chaine" />
|
|
|
|
<a href="{{ url_for('twitchConfigurationHelp') }}" class="help-link">
|
|
❓ Besoin d'aide pour configurer Twitch ?
|
|
</a>
|
|
|
|
{% if configuration.getValue('twitch_client_secret') and configuration.getValue('twitch_client_id') %}
|
|
<div class="config-card" style="margin-top: var(--space-lg);">
|
|
<div class="config-card-header">
|
|
<h3>🔐 Tokens d'accès</h3>
|
|
</div>
|
|
|
|
<a href="{{ url_for('twitchRequestToken') }}" class="btn" style="margin-bottom: var(--space-md); display: inline-flex;">
|
|
🔄 Obtenir/Rafraîchir les tokens
|
|
</a>
|
|
|
|
<label for="twitch_access_token">Access Token</label>
|
|
<input name="twitch_access_token" id="twitch_access_token" type="text" value="{{ configuration.getValue('twitch_access_token') }}" readonly />
|
|
|
|
<label for="twitch_refresh_token">Refresh Token</label>
|
|
<input name="twitch_refresh_token" id="twitch_refresh_token" type="text" value="{{ configuration.getValue('twitch_refresh_token') }}" readonly />
|
|
|
|
<small>⚠️ Nécessite un redémarrage après l'obtention des tokens</small>
|
|
</div>
|
|
{% endif %}
|
|
|
|
<div class="config-actions">
|
|
<input type="submit" value="💾 Enregistrer Twitch">
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Section Humble Bundle -->
|
|
<div class="config-section" data-section="humble">
|
|
<div class="config-section-header" onclick="toggleSection(this)">
|
|
<div class="config-section-icon">🎁</div>
|
|
<div class="config-section-title">
|
|
<h2>Humble Bundle</h2>
|
|
<p>Notifications automatiques des nouveaux bundles de jeux</p>
|
|
</div>
|
|
<svg class="config-section-chevron" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
<path d="M6 9l6 6 6-6"/>
|
|
</svg>
|
|
</div>
|
|
<div class="config-section-content">
|
|
<form action="{{ url_for('updateConfiguration') }}" method="POST">
|
|
<p style="color: var(--text-secondary); margin-bottom: var(--space-lg);">
|
|
Humble Bundle propose régulièrement des bundles de jeux vidéo à prix réduits. Activez les notifications pour recevoir automatiquement les nouveaux packs sur votre serveur Discord.
|
|
</p>
|
|
|
|
<div class="toggle-row">
|
|
<label for="humble_bundle_enable">Activer les notifications Humble Bundle</label>
|
|
<div class="toggle-switch">
|
|
<input type="checkbox" name="humble_bundle_enable" id="humble_bundle_enable" {% if configuration.getValue('humble_bundle_enable') %}checked{% endif %}>
|
|
<span class="toggle-slider"></span>
|
|
</div>
|
|
</div>
|
|
|
|
<label for="humble_bundle_channel">Canal de notification</label>
|
|
<select name="humble_bundle_channel" id="humble_bundle_channel">
|
|
{% for channel in channels %}
|
|
<option value="{{channel.id}}" {% if configuration.getIntValue('humble_bundle_channel')==channel.id %}selected{% endif %}>
|
|
#{{channel.name}}
|
|
</option>
|
|
{% endfor %}
|
|
</select>
|
|
|
|
<div class="config-actions">
|
|
<input type="submit" value="💾 Enregistrer Humble Bundle">
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Section Zone Danger -->
|
|
<div class="config-section danger" data-section="danger">
|
|
<div class="config-section-header" onclick="toggleSection(this)">
|
|
<div class="config-section-icon">⚠️</div>
|
|
<div class="config-section-title">
|
|
<h2>Zone Danger</h2>
|
|
<p>Actions irréversibles - Utilisez avec précaution</p>
|
|
</div>
|
|
<svg class="config-section-chevron" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
<path d="M6 9l6 6 6-6"/>
|
|
</svg>
|
|
</div>
|
|
<div class="config-section-content">
|
|
<form action="{{ url_for('leaveGuild') }}" method="POST" onsubmit="return confirmLeave();">
|
|
<div class="danger-box">
|
|
<span class="danger-box-icon">🚨</span>
|
|
<div class="danger-box-content">
|
|
<strong>Quitter un serveur Discord</strong>
|
|
<p>Cette action est irréversible ! Le bot quittera définitivement le serveur sélectionné. Pour rejoindre à nouveau, vous devrez ré-inviter le bot.</p>
|
|
</div>
|
|
</div>
|
|
|
|
{% if guilds and guilds|length > 0 %}
|
|
<label for="guild_id">Sélectionner un serveur à quitter</label>
|
|
<select name="guild_id" id="guild_id" required>
|
|
<option value="">-- Choisir un serveur --</option>
|
|
{% for guild in guilds %}
|
|
<option value="{{ guild.id }}">{{ guild.name }} ({{ guild.member_count }} membres)</option>
|
|
{% endfor %}
|
|
</select>
|
|
|
|
<div class="toggle-row" style="background: rgba(220, 38, 38, 0.1); margin-top: var(--space-md);">
|
|
<label for="confirm_leave" style="color: var(--danger);">Je confirme vouloir faire quitter le bot de ce serveur</label>
|
|
<div class="toggle-switch">
|
|
<input type="checkbox" name="confirm_leave" id="confirm_leave" value="1" required>
|
|
<span class="toggle-slider"></span>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="config-actions">
|
|
<input type="submit" value="🚪 Quitter le serveur" class="btn-danger" style="flex: none;">
|
|
</div>
|
|
{% else %}
|
|
<p style="color: var(--text-muted); text-align: center; padding: var(--space-lg);">
|
|
Aucun serveur Discord connecté ou le bot n'est pas encore démarré.
|
|
</p>
|
|
{% endif %}
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
// Toggle section open/close
|
|
function toggleSection(header) {
|
|
const section = header.closest('.config-section');
|
|
section.classList.toggle('open');
|
|
}
|
|
|
|
// Toggle token visibility
|
|
function toggleTokenVisibility(inputId, button) {
|
|
const input = document.getElementById(inputId);
|
|
if (input.type === 'password') {
|
|
input.type = 'text';
|
|
button.textContent = '🙈';
|
|
} else {
|
|
input.type = 'password';
|
|
button.textContent = '👁️';
|
|
}
|
|
}
|
|
|
|
// Switch guild tabs
|
|
function switchGuildTab(button, contentId) {
|
|
// Get parent tabs container
|
|
const tabsContainer = button.closest('.guild-tabs');
|
|
const card = button.closest('.config-card');
|
|
|
|
// Deactivate all tabs in this group
|
|
tabsContainer.querySelectorAll('.guild-tab').forEach(tab => tab.classList.remove('active'));
|
|
button.classList.add('active');
|
|
|
|
// Hide all content in this card
|
|
card.querySelectorAll('.guild-content').forEach(content => content.classList.remove('active'));
|
|
document.getElementById(contentId).classList.add('active');
|
|
}
|
|
|
|
// Confirm leave guild
|
|
function confirmLeave() {
|
|
const select = document.getElementById('guild_id');
|
|
if (!select.value) {
|
|
alert('Veuillez sélectionner un serveur.');
|
|
return false;
|
|
}
|
|
const serverName = select.options[select.selectedIndex].text;
|
|
return confirm('Êtes-vous VRAIMENT sûr de vouloir quitter le serveur "' + serverName + '" ?\n\nCette action est IRRÉVERSIBLE !');
|
|
}
|
|
</script>
|
|
{% endblock %}
|