Ajout de nouvelles fonctionnalités pour la gestion des alertes YouTube, y compris l'affichage de la dernière vidéo et de sa date dans l'interface.
This commit is contained in:
@@ -22,11 +22,13 @@ RUN sed -i 's/# fr_FR.UTF-8 UTF-8/fr_FR.UTF-8 UTF-8/' /etc/locale.gen; \
|
||||
|
||||
COPY requirements.txt .
|
||||
COPY run-web.py .
|
||||
COPY shared_stats.py .
|
||||
COPY ./database ./database
|
||||
COPY ./discordbot ./discordbot
|
||||
COPY ./protondb ./protondb
|
||||
COPY ./webapp ./webapp
|
||||
COPY ./twitchbot ./twitchbot
|
||||
COPY ./youtubebot ./youtubebot
|
||||
COPY start.sh /start.sh
|
||||
|
||||
RUN python3 -m venv /app/venv && \
|
||||
|
||||
@@ -102,4 +102,6 @@ class YoutubeAlert(db.Model):
|
||||
notify_channel = db.Column(db.Integer)
|
||||
message = db.Column(db.String(2000))
|
||||
last_video_id = db.Column(db.String(64))
|
||||
last_video_title = db.Column(db.String(512))
|
||||
last_video_date = db.Column(db.DateTime)
|
||||
|
||||
|
||||
+3
-1
@@ -116,5 +116,7 @@ CREATE TABLE IF NOT EXISTS `youtube_alert` (
|
||||
`channel_name` VARCHAR(256),
|
||||
`notify_channel` INTEGER NOT NULL,
|
||||
`message` VARCHAR(2000) NOT NULL,
|
||||
`last_video_id` VARCHAR(64)
|
||||
`last_video_id` VARCHAR(64),
|
||||
`last_video_title` VARCHAR(512),
|
||||
`last_video_date` DATETIME
|
||||
);
|
||||
|
||||
@@ -548,6 +548,38 @@ table.youtube-alert tr td:last-child {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* YouTube Alert - Last Video Column */
|
||||
table.youtube-alert td.last-video {
|
||||
min-width: 180px;
|
||||
max-width: 280px;
|
||||
}
|
||||
|
||||
table.youtube-alert td.last-video a {
|
||||
display: block;
|
||||
font-weight: 500;
|
||||
color: var(--text-primary);
|
||||
margin-bottom: var(--space-xs);
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
table.youtube-alert td.last-video a:hover {
|
||||
color: var(--accent);
|
||||
}
|
||||
|
||||
table.youtube-alert td.last-video small {
|
||||
display: block;
|
||||
color: var(--text-muted);
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
|
||||
table.youtube-alert td.last-video .no-video {
|
||||
color: var(--text-muted);
|
||||
font-style: italic;
|
||||
font-size: var(--text-sm);
|
||||
}
|
||||
|
||||
/* === Code === */
|
||||
code, pre {
|
||||
font-family: var(--font-mono);
|
||||
@@ -1362,6 +1394,511 @@ dialog::backdrop {
|
||||
color: var(--danger);
|
||||
}
|
||||
|
||||
/* === Configuration Page === */
|
||||
.config-page {
|
||||
max-width: 900px;
|
||||
}
|
||||
|
||||
.config-page h1 {
|
||||
font-size: var(--text-2xl);
|
||||
margin-bottom: var(--space-sm);
|
||||
}
|
||||
|
||||
.config-page > p {
|
||||
color: var(--text-muted);
|
||||
margin-bottom: var(--space-xl);
|
||||
}
|
||||
|
||||
/* Config Section */
|
||||
.config-section {
|
||||
background: var(--bg-secondary);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius-md);
|
||||
margin-bottom: var(--space-md);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.config-section.danger {
|
||||
border-color: rgba(220, 38, 38, 0.3);
|
||||
}
|
||||
|
||||
.config-section-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--space-md);
|
||||
padding: var(--space-lg);
|
||||
cursor: pointer;
|
||||
user-select: none;
|
||||
transition: background 0.15s ease;
|
||||
}
|
||||
|
||||
.config-section-header:hover {
|
||||
background: var(--bg-tertiary);
|
||||
}
|
||||
|
||||
.config-section.danger .config-section-header:hover {
|
||||
background: rgba(220, 38, 38, 0.05);
|
||||
}
|
||||
|
||||
.config-section-icon {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
background: var(--accent-soft);
|
||||
border-radius: var(--radius-md);
|
||||
font-size: 1.25rem;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.config-section.danger .config-section-icon {
|
||||
background: rgba(220, 38, 38, 0.1);
|
||||
}
|
||||
|
||||
.config-section-title {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.config-section-title h2 {
|
||||
font-size: var(--text-lg);
|
||||
margin: 0;
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.config-section.danger .config-section-title h2 {
|
||||
color: var(--danger);
|
||||
}
|
||||
|
||||
.config-section-title p {
|
||||
font-size: var(--text-sm);
|
||||
color: var(--text-muted);
|
||||
margin: var(--space-xs) 0 0 0;
|
||||
}
|
||||
|
||||
.config-section-chevron {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
color: var(--text-muted);
|
||||
transition: transform 0.2s ease;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.config-section.open .config-section-chevron {
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
|
||||
.config-section-content {
|
||||
display: none;
|
||||
padding: 0 var(--space-lg) var(--space-lg);
|
||||
border-top: 1px solid var(--border);
|
||||
animation: slideDown 0.2s ease;
|
||||
}
|
||||
|
||||
.config-section.open .config-section-content {
|
||||
display: block;
|
||||
}
|
||||
|
||||
@keyframes slideDown {
|
||||
from { opacity: 0; transform: translateY(-8px); }
|
||||
to { opacity: 1; transform: translateY(0); }
|
||||
}
|
||||
|
||||
/* Config Cards */
|
||||
.config-card {
|
||||
background: var(--bg-tertiary);
|
||||
border-radius: var(--radius-md);
|
||||
padding: var(--space-lg);
|
||||
margin-top: var(--space-lg);
|
||||
}
|
||||
|
||||
.config-card:first-child {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.config-card-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--space-sm);
|
||||
margin-bottom: var(--space-md);
|
||||
}
|
||||
|
||||
.config-card-header h3 {
|
||||
font-size: var(--text-base);
|
||||
font-weight: 600;
|
||||
margin: 0;
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.config-card-header .badge {
|
||||
font-size: 0.7rem;
|
||||
padding: 2px 8px;
|
||||
}
|
||||
|
||||
/* Config Form Overrides */
|
||||
.config-section form {
|
||||
background: none;
|
||||
border: none;
|
||||
padding: 0;
|
||||
max-width: none;
|
||||
}
|
||||
|
||||
.config-section input[type="text"],
|
||||
.config-section input[type="password"],
|
||||
.config-section input[type="number"],
|
||||
.config-section select,
|
||||
.config-section textarea {
|
||||
background: var(--bg-secondary);
|
||||
margin-bottom: var(--space-sm);
|
||||
}
|
||||
|
||||
.config-section label {
|
||||
margin-bottom: var(--space-xs);
|
||||
margin-top: var(--space-md);
|
||||
}
|
||||
|
||||
.config-section label:first-child {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.config-section small {
|
||||
display: block;
|
||||
margin-top: var(--space-xs);
|
||||
margin-bottom: var(--space-md);
|
||||
color: var(--text-muted);
|
||||
font-size: var(--text-sm);
|
||||
}
|
||||
|
||||
/* Toggle Switch */
|
||||
.toggle-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: var(--space-md);
|
||||
padding: var(--space-md);
|
||||
background: var(--bg-secondary);
|
||||
border-radius: var(--radius-sm);
|
||||
margin-bottom: var(--space-sm);
|
||||
transition: background 0.15s ease;
|
||||
}
|
||||
|
||||
.toggle-row:hover {
|
||||
background: var(--accent-soft);
|
||||
}
|
||||
|
||||
.toggle-row label {
|
||||
margin: 0;
|
||||
flex: 1;
|
||||
font-weight: 400;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.toggle-switch {
|
||||
position: relative;
|
||||
width: 48px;
|
||||
height: 26px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.toggle-switch input {
|
||||
opacity: 0;
|
||||
width: 0;
|
||||
height: 0;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.toggle-slider {
|
||||
position: absolute;
|
||||
cursor: pointer;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-color: var(--border);
|
||||
border-radius: var(--radius-full);
|
||||
transition: 0.3s;
|
||||
}
|
||||
|
||||
.toggle-slider:before {
|
||||
position: absolute;
|
||||
content: "";
|
||||
height: 20px;
|
||||
width: 20px;
|
||||
left: 3px;
|
||||
bottom: 3px;
|
||||
background-color: white;
|
||||
border-radius: 50%;
|
||||
transition: 0.3s;
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
|
||||
.toggle-switch input:checked + .toggle-slider {
|
||||
background-color: var(--success);
|
||||
}
|
||||
|
||||
.toggle-switch input:checked + .toggle-slider:before {
|
||||
transform: translateX(22px);
|
||||
}
|
||||
|
||||
.toggle-switch input:focus + .toggle-slider {
|
||||
box-shadow: 0 0 0 3px var(--accent-soft);
|
||||
}
|
||||
|
||||
/* Syntax Helper */
|
||||
.syntax-helper {
|
||||
background: var(--bg-secondary);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius-sm);
|
||||
padding: var(--space-md);
|
||||
margin-top: var(--space-sm);
|
||||
}
|
||||
|
||||
.syntax-helper summary {
|
||||
font-size: var(--text-sm);
|
||||
font-weight: 500;
|
||||
color: var(--text-secondary);
|
||||
cursor: pointer;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.syntax-helper summary:hover {
|
||||
color: var(--accent);
|
||||
}
|
||||
|
||||
.syntax-list {
|
||||
margin-top: var(--space-md);
|
||||
display: grid;
|
||||
gap: var(--space-sm);
|
||||
}
|
||||
|
||||
.syntax-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--space-md);
|
||||
font-size: var(--text-sm);
|
||||
}
|
||||
|
||||
.syntax-item code {
|
||||
flex-shrink: 0;
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
|
||||
.syntax-item span {
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
/* Roles Selector */
|
||||
.roles-container {
|
||||
background: var(--bg-secondary);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius-sm);
|
||||
max-height: 280px;
|
||||
overflow-y: auto;
|
||||
margin-top: var(--space-sm);
|
||||
}
|
||||
|
||||
.role-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--space-sm);
|
||||
padding: var(--space-sm) var(--space-md);
|
||||
transition: background 0.1s ease;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.role-item:hover {
|
||||
background: var(--accent-soft);
|
||||
}
|
||||
|
||||
.role-item input[type="checkbox"] {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.role-item label {
|
||||
margin: 0;
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--space-sm);
|
||||
cursor: pointer;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
.role-color {
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
border-radius: 50%;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
/* Guild Tabs */
|
||||
.guild-tabs {
|
||||
display: flex;
|
||||
gap: var(--space-xs);
|
||||
margin-bottom: var(--space-md);
|
||||
border-bottom: 1px solid var(--border);
|
||||
padding-bottom: var(--space-xs);
|
||||
}
|
||||
|
||||
.guild-tab {
|
||||
padding: var(--space-sm) var(--space-md);
|
||||
font-size: var(--text-sm);
|
||||
font-weight: 500;
|
||||
color: var(--text-muted);
|
||||
background: transparent;
|
||||
border: none;
|
||||
border-radius: var(--radius-sm) var(--radius-sm) 0 0;
|
||||
cursor: pointer;
|
||||
transition: all 0.15s ease;
|
||||
}
|
||||
|
||||
.guild-tab:hover {
|
||||
color: var(--text-primary);
|
||||
background: var(--bg-tertiary);
|
||||
}
|
||||
|
||||
.guild-tab.active {
|
||||
color: var(--accent);
|
||||
background: var(--accent-soft);
|
||||
}
|
||||
|
||||
.guild-content {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.guild-content.active {
|
||||
display: block;
|
||||
}
|
||||
|
||||
/* Warning Box */
|
||||
.warning-box {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: var(--space-md);
|
||||
padding: var(--space-md);
|
||||
background: rgba(245, 158, 11, 0.1);
|
||||
border: 1px solid rgba(245, 158, 11, 0.3);
|
||||
border-radius: var(--radius-sm);
|
||||
margin-bottom: var(--space-lg);
|
||||
}
|
||||
|
||||
.warning-box-icon {
|
||||
font-size: 1.25rem;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.warning-box-content {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.warning-box-content strong {
|
||||
display: block;
|
||||
color: #f59e0b;
|
||||
margin-bottom: var(--space-xs);
|
||||
}
|
||||
|
||||
.warning-box-content p {
|
||||
color: var(--text-secondary);
|
||||
margin: 0;
|
||||
font-size: var(--text-sm);
|
||||
}
|
||||
|
||||
/* Danger Box */
|
||||
.danger-box {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: var(--space-md);
|
||||
padding: var(--space-md);
|
||||
background: rgba(220, 38, 38, 0.1);
|
||||
border: 1px solid rgba(220, 38, 38, 0.3);
|
||||
border-radius: var(--radius-sm);
|
||||
margin-bottom: var(--space-lg);
|
||||
}
|
||||
|
||||
.danger-box-icon {
|
||||
font-size: 1.25rem;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.danger-box-content {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.danger-box-content strong {
|
||||
display: block;
|
||||
color: var(--danger);
|
||||
margin-bottom: var(--space-xs);
|
||||
}
|
||||
|
||||
.danger-box-content p {
|
||||
color: var(--text-secondary);
|
||||
margin: 0;
|
||||
font-size: var(--text-sm);
|
||||
}
|
||||
|
||||
/* Config Actions */
|
||||
.config-actions {
|
||||
display: flex;
|
||||
gap: var(--space-sm);
|
||||
margin-top: var(--space-lg);
|
||||
padding-top: var(--space-lg);
|
||||
border-top: 1px solid var(--border);
|
||||
}
|
||||
|
||||
.config-actions button,
|
||||
.config-actions input[type="submit"] {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
@media (max-width: 480px) {
|
||||
.config-actions {
|
||||
flex-direction: column;
|
||||
}
|
||||
}
|
||||
|
||||
/* Token Input */
|
||||
.token-input-wrapper {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.token-input-wrapper input {
|
||||
padding-right: 50px;
|
||||
}
|
||||
|
||||
.token-toggle {
|
||||
position: absolute;
|
||||
right: 8px;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
background: none;
|
||||
border: none;
|
||||
color: var(--text-muted);
|
||||
cursor: pointer;
|
||||
padding: var(--space-xs);
|
||||
font-size: 1rem;
|
||||
transition: color 0.15s ease;
|
||||
}
|
||||
|
||||
.token-toggle:hover {
|
||||
color: var(--text-primary);
|
||||
background: none;
|
||||
transform: translateY(-50%);
|
||||
}
|
||||
|
||||
/* Help Link */
|
||||
.help-link {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: var(--space-xs);
|
||||
font-size: var(--text-sm);
|
||||
color: var(--accent);
|
||||
margin-top: var(--space-sm);
|
||||
}
|
||||
|
||||
.help-link:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
/* === Responsive === */
|
||||
@media (max-width: 640px) {
|
||||
:root {
|
||||
@@ -1399,4 +1936,30 @@ dialog::backdrop {
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.config-section-header {
|
||||
padding: var(--space-md);
|
||||
}
|
||||
|
||||
.config-section-icon {
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.config-section-title h2 {
|
||||
font-size: var(--text-base);
|
||||
}
|
||||
|
||||
.toggle-row {
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: var(--space-sm);
|
||||
}
|
||||
|
||||
.syntax-item {
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: var(--space-xs);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,370 +1,476 @@
|
||||
{% extends "template.html" %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Configuration de Mamie</h1>
|
||||
<p>Configurez les tokens Discord, les notifications Humble Bundle et l'API Twitch.</p>
|
||||
<div class="config-page">
|
||||
<h1>⚙️ Configuration</h1>
|
||||
<p>Paramétrez Discord, Twitch, YouTube et les fonctionnalités du bot.</p>
|
||||
|
||||
<h2>Discord</h2>
|
||||
|
||||
{% with messages = get_flashed_messages(with_categories=true) %}
|
||||
{% if messages %}
|
||||
{% for category, message in messages %}
|
||||
<div class="alert alert-{{ category }}" style="padding: 10px; margin: 10px 0; border-radius: 5px; {% if category == 'error' %}background-color: #f8d7da; color: #721c24; border: 1px solid #f5c6cb;{% else %}background-color: #d4edda; color: #155724; border: 1px solid #c3e6cb;{% endif %}">
|
||||
{{ message }}
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
|
||||
<form action="{{ url_for('updateConfiguration') }}" method="POST">
|
||||
<fieldset>
|
||||
<legend>API Discord</legend>
|
||||
<label for="discord_token">Token Discord (caché)</label>
|
||||
<input name="discord_token" type="password" placeholder="Votre token Discord" />
|
||||
<small>Nécessite un redémarrage après modification</small>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend>Messages de bienvenue</legend>
|
||||
<label for="welcome_enable">
|
||||
<input type="checkbox" name="welcome_enable" {% if configuration.getValue('welcome_enable') %}checked="checked"{% endif %}>
|
||||
Activer le message de bienvenue pour les nouveaux membres
|
||||
</label>
|
||||
|
||||
<label for="welcome_channel_id">Canal de bienvenue</label>
|
||||
<select name="welcome_channel_id">
|
||||
{% for channel in channels %}
|
||||
<option value="{{channel.id}}" {% if configuration.getIntValue('welcome_channel_id')==channel.id %}selected="selected"{% endif %}>
|
||||
{{channel.name}}
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
|
||||
<label for="welcome_message">Message personnalisé de bienvenue</label>
|
||||
<textarea name="welcome_message" rows="3" placeholder="Bienvenue {member.mention} sur le serveur !">{{ configuration.getValue('welcome_message') }}</textarea>
|
||||
<small>
|
||||
<strong>Syntaxes disponibles :</strong><br>
|
||||
• <code>{member.mention}</code> - Mentionne l'utilisateur (@NomUtilisateur)<br>
|
||||
• <code>{member.name}</code> - Nom d'utilisateur (sans mention)<br>
|
||||
• <code>{member.display_name}</code> - Surnom sur le serveur<br>
|
||||
• <code>{member.id}</code> - ID de l'utilisateur<br>
|
||||
• <code>{server.name}</code> - Nom du serveur<br>
|
||||
• <code>{server.member_count}</code> - Nombre total de membres<br>
|
||||
• <code><#ID_DU_CHANNEL></code> - Mentionne un salon (ex: <#123456789012345678>)
|
||||
</small>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend>Auto-Role</legend>
|
||||
<label for="autorole_enable">
|
||||
<input type="checkbox" name="autorole_enable" {% if configuration.getValue('autorole_enable') %}checked="checked"{% endif %}>
|
||||
Attribuer automatiquement un rôle aux nouveaux membres
|
||||
</label>
|
||||
|
||||
<label for="autorole_role_id">Rôle à attribuer</label>
|
||||
{% if roles|length > 1 %}
|
||||
<div class="tabs tabs-autorole">
|
||||
{% for guild_data in roles %}
|
||||
<button type="button" class="tab-button-autorole" onclick="openTabAutorole(event, 'autorole-guild-{{guild_data.guild_id}}')" {% if loop.first %}id="defaultOpenAutorole"{% endif %}>
|
||||
{{ guild_data.guild_name }}
|
||||
</button>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% for guild_data in roles %}
|
||||
<div id="autorole-guild-{{guild_data.guild_id}}" class="tab-content-autorole" {% if not loop.first %}style="display: none;"{% 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="selected"{% endif %}>
|
||||
{% if role.color.value != 0 %}⬤{% else %}○{% endif %} {{role.name}}
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
<small>
|
||||
<strong>Note :</strong> Le bot doit avoir la permission "Gérer les rôles" et son rôle doit être positionné plus haut que le rôle à attribuer dans la hiérarchie des rôles.
|
||||
</small>
|
||||
|
||||
<script>
|
||||
function openTabAutorole(evt, tabName) {
|
||||
var i, tabcontent, tabbuttons;
|
||||
tabcontent = document.getElementsByClassName("tab-content-autorole");
|
||||
for (i = 0; i < tabcontent.length; i++) {
|
||||
tabcontent[i].style.display = "none";
|
||||
}
|
||||
tabbuttons = document.getElementsByClassName("tab-button-autorole");
|
||||
for (i = 0; i < tabbuttons.length; i++) {
|
||||
tabbuttons[i].className = tabbuttons[i].className.replace(" active", "");
|
||||
}
|
||||
document.getElementById(tabName).style.display = "block";
|
||||
evt.currentTarget.className += " active";
|
||||
}
|
||||
document.getElementById("defaultOpenAutorole")?.click();
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.tabs-autorole {
|
||||
overflow: hidden;
|
||||
border-bottom: 2px solid #ccc;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.tab-button-autorole {
|
||||
background-color: #f1f1f1;
|
||||
border: none;
|
||||
outline: none;
|
||||
cursor: pointer;
|
||||
padding: 10px 20px;
|
||||
transition: 0.3s;
|
||||
font-size: 14px;
|
||||
margin-right: 2px;
|
||||
}
|
||||
.tab-button-autorole:hover {
|
||||
background-color: #ddd;
|
||||
}
|
||||
.tab-button-autorole.active {
|
||||
background-color: #ccc;
|
||||
font-weight: bold;
|
||||
}
|
||||
.tab-content-autorole {
|
||||
animation: fadeEffect 0.3s;
|
||||
}
|
||||
</style>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend>Messages de départ</legend>
|
||||
<label for="leave_enable">
|
||||
<input type="checkbox" name="leave_enable" {% if configuration.getValue('leave_enable') %}checked="checked"{% endif %}>
|
||||
Activer le message de départ quand un membre quitte le serveur
|
||||
</label>
|
||||
|
||||
<label for="leave_channel_id">Canal de départ</label>
|
||||
<select name="leave_channel_id">
|
||||
{% for channel in channels %}
|
||||
<option value="{{channel.id}}" {% if configuration.getIntValue('leave_channel_id')==channel.id %}selected="selected"{% endif %}>
|
||||
{{channel.name}}
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
|
||||
<label for="leave_message">Message personnalisé de départ</label>
|
||||
<textarea name="leave_message" rows="3" placeholder="{member.mention} a quitté le serveur.">{{ configuration.getValue('leave_message') }}</textarea>
|
||||
<small>
|
||||
<strong>Syntaxes disponibles :</strong><br>
|
||||
• <code>{member.mention}</code> - Mentionne l'utilisateur (@NomUtilisateur)<br>
|
||||
• <code>{member.name}</code> - Nom d'utilisateur (sans mention)<br>
|
||||
• <code>{member.display_name}</code> - Surnom sur le serveur<br>
|
||||
• <code>{member.id}</code> - ID de l'utilisateur<br>
|
||||
• <code>{server.name}</code> - Nom du serveur<br>
|
||||
• <code>{server.member_count}</code> - Nombre total de membres<br>
|
||||
• <code><#ID_DU_CHANNEL></code> - Mentionne un salon (ex: <#123456789012345678>)
|
||||
</small>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend>Modération</legend>
|
||||
<label for="moderation_enable">
|
||||
<input type="checkbox" name="moderation_enable" {% if configuration.getValue('moderation_enable') %}checked="checked"{% endif %}>
|
||||
Activer les commandes d'avertissement (!warn, !unwarn, !inspect)
|
||||
</label>
|
||||
|
||||
<label for="moderation_ban_enable">
|
||||
<input type="checkbox" name="moderation_ban_enable" {% if configuration.getValue('moderation_ban_enable') %}checked="checked"{% endif %}>
|
||||
Activer les commandes de bannissement (!ban, !unban)
|
||||
</label>
|
||||
|
||||
<label for="moderation_kick_enable">
|
||||
<input type="checkbox" name="moderation_kick_enable" {% if configuration.getValue('moderation_kick_enable') %}checked="checked"{% endif %}>
|
||||
Activer la commande d'expulsion (!kick)
|
||||
</label>
|
||||
|
||||
<label for="moderation_log_channel_id">Canal de logs de modération</label>
|
||||
<select name="moderation_log_channel_id">
|
||||
{% for channel in channels %}
|
||||
<option value="{{channel.id}}" {% if configuration.getIntValue('moderation_log_channel_id')==channel.id %}selected="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="tabs">
|
||||
{% for guild_data in roles %}
|
||||
<button type="button" class="tab-button" onclick="openTab(event, 'guild-{{guild_data.guild_id}}')" {% if loop.first %}id="defaultOpen"{% endif %}>
|
||||
{{ guild_data.guild_name }}
|
||||
</button>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% for guild_data in roles %}
|
||||
<div id="guild-{{guild_data.guild_id}}" class="tab-content" {% if not loop.first %}style="display: none;"{% endif %}>
|
||||
<div style="max-height: 300px; overflow-y: auto; border: 1px solid #ccc; padding: 10px; border-radius: 5px;">
|
||||
{% for role in guild_data.roles %}
|
||||
<label style="display: block; margin: 5px 0;">
|
||||
<input type="checkbox" name="moderation_staff_role_ids" value="{{role.id}}" {% if role.id|string in selected_roles %}checked="checked"{% endif %}>
|
||||
{% if role.color.value != 0 %}
|
||||
<span style="color:#{{ '%06x' % role.color.value }}">●</span>
|
||||
{% else %}
|
||||
<span>○</span>
|
||||
{% endif %}
|
||||
{{role.name}}
|
||||
</label>
|
||||
{% endfor %}
|
||||
<!-- 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>
|
||||
{% endfor %}
|
||||
|
||||
<small>Sélectionnez un ou plusieurs rôles qui peuvent utiliser les commandes de modération</small>
|
||||
|
||||
<script>
|
||||
function openTab(evt, tabName) {
|
||||
var i, tabcontent, tabbuttons;
|
||||
tabcontent = document.getElementsByClassName("tab-content");
|
||||
for (i = 0; i < tabcontent.length; i++) {
|
||||
tabcontent[i].style.display = "none";
|
||||
}
|
||||
tabbuttons = document.getElementsByClassName("tab-button");
|
||||
for (i = 0; i < tabbuttons.length; i++) {
|
||||
tabbuttons[i].className = tabbuttons[i].className.replace(" active", "");
|
||||
}
|
||||
document.getElementById(tabName).style.display = "block";
|
||||
evt.currentTarget.className += " active";
|
||||
}
|
||||
document.getElementById("defaultOpen")?.click();
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.tabs {
|
||||
overflow: hidden;
|
||||
border-bottom: 2px solid #ccc;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.tab-button {
|
||||
background-color: #f1f1f1;
|
||||
border: none;
|
||||
outline: none;
|
||||
cursor: pointer;
|
||||
padding: 10px 20px;
|
||||
transition: 0.3s;
|
||||
font-size: 14px;
|
||||
margin-right: 2px;
|
||||
}
|
||||
.tab-button:hover {
|
||||
background-color: #ddd;
|
||||
}
|
||||
.tab-button.active {
|
||||
background-color: #ccc;
|
||||
font-weight: bold;
|
||||
}
|
||||
.tab-content {
|
||||
animation: fadeEffect 0.3s;
|
||||
}
|
||||
@keyframes fadeEffect {
|
||||
from {opacity: 0;}
|
||||
to {opacity: 1;}
|
||||
}
|
||||
</style>
|
||||
|
||||
<label for="moderation_embed_delete_delay">Délai de suppression des embeds (en secondes)</label>
|
||||
<input name="moderation_embed_delete_delay" type="number" value="{{ configuration.getValue('moderation_embed_delete_delay') or '0' }}" placeholder="0" min="0" />
|
||||
<small>Mettre 0 pour ne pas supprimer automatiquement</small>
|
||||
</fieldset>
|
||||
<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>
|
||||
|
||||
<input type="Submit" value="Enregistrer la configuration Discord">
|
||||
</form>
|
||||
<!-- 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>
|
||||
|
||||
<h2>API Twitch</h2>
|
||||
<form action="{{ url_for('updateConfiguration') }}" method="POST">
|
||||
<label for="twitch_client_id">Client ID</label>
|
||||
<input name="twitch_client_id" type="text" value="{{ configuration.getValue('twitch_client_id') }}" />
|
||||
<label for="twitch_client_secret">Client Secret</label>
|
||||
<input name="twitch_client_secret" type="text" value="{{ configuration.getValue('twitch_client_secret') }}" />
|
||||
<label for="twitch_channel">Chaîne à rejoindre</label>
|
||||
<input name="twitch_channel" type="text" value="{{ configuration.getValue('twitch_channel') }}"
|
||||
placeholder="#machinTruc" />
|
||||
<input type="Submit" value="Enregistrer la configuration Twitch">
|
||||
<p>
|
||||
<a href="{{ url_for('twitchConfigurationHelp') }}">Aide</a>
|
||||
</p>
|
||||
{% if configuration.getValue('twitch_client_secret') and configuration.getValue('twitch_client_id') %}
|
||||
<p>
|
||||
<a href="{{ url_for('twitchRequestToken') }}">Obtenir token et refresh token</a>
|
||||
</p>
|
||||
<label for="twitch_access_token">Access Token</label>
|
||||
<input name="twitch_access_token" type="text" value="{{ configuration.getValue('twitch_access_token') }}"
|
||||
readonly="readonly" />
|
||||
<label for="twitch_refresh_token">Refresh Token</label>
|
||||
<input name="twitch_refresh_token" type="text" value="{{ configuration.getValue('twitch_refresh_token') }}"
|
||||
readonly="readonly" />
|
||||
<p>Nécessite un redémarrage après l'obtention des Tokens.</p>
|
||||
{% endif %}
|
||||
</form>
|
||||
<!-- 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>
|
||||
|
||||
<h2>Humble Bundle</h2>
|
||||
<form action="{{ url_for('updateConfiguration') }}" method="POST">
|
||||
<p>Humble Bundle propose régulièrement des bundles de jeux vidéo à des prix réduits. Activez les notifications pour recevoir automatiquement les nouveaux packs disponibles sur votre serveur Discord.</p>
|
||||
<!-- 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>
|
||||
|
||||
<label for="humble_bundle_enable">
|
||||
<input type="checkbox" name="humble_bundle_enable" {% if configuration.getValue('humble_bundle_enable') %}checked="checked"{% endif %}>
|
||||
Activer les notifications Humble Bundle
|
||||
</label>
|
||||
<!-- 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>
|
||||
|
||||
<label for="humble_bundle_channel">Canal de notification</label>
|
||||
<select name="humble_bundle_channel">
|
||||
{% for channel in channels %}
|
||||
<option value="{{channel.id}}" {% if configuration.getIntValue('humble_bundle_channel')==channel.id %}selected="selected"{% endif %}>
|
||||
{{channel.name}}
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<div class="config-actions">
|
||||
<input type="submit" value="💾 Enregistrer Discord">
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input type="Submit" value="Enregistrer la configuration Humble Bundle">
|
||||
</form>
|
||||
<!-- 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 %}
|
||||
|
||||
<h2>⚠️ Gestion des serveurs</h2>
|
||||
<form action="{{ url_for('leaveGuild') }}" method="POST" onsubmit="return confirmLeave();">
|
||||
<fieldset>
|
||||
<legend>Quitter un serveur Discord</legend>
|
||||
<p style="color: #856404; background-color: #fff3cd; border: 1px solid #ffeeba; padding: 10px; border-radius: 5px;">
|
||||
<strong>⚠️ Attention :</strong> Cette action est irréversible ! Le bot quittera définitivement le serveur sélectionné.
|
||||
Pour rejoindre à nouveau, vous devrez ré-inviter le bot.
|
||||
</p>
|
||||
|
||||
{% 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>
|
||||
|
||||
<label for="confirm_leave" style="margin-top: 15px;">
|
||||
<input type="checkbox" name="confirm_leave" id="confirm_leave" value="1" required>
|
||||
Je confirme vouloir faire quitter le bot de ce serveur
|
||||
</label>
|
||||
|
||||
<input type="submit" value="🚪 Quitter le serveur" style="background-color: #dc3545; border-color: #dc3545;" />
|
||||
{% else %}
|
||||
<p>Aucun serveur Discord connecté ou le bot n'est pas encore démarré.</p>
|
||||
{% endif %}
|
||||
</fieldset>
|
||||
</form>
|
||||
<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() {
|
||||
var select = document.getElementById('guild_id');
|
||||
var serverName = select.options[select.selectedIndex].text;
|
||||
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 %}
|
||||
{% endblock %}
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
<th>Chaîne</th>
|
||||
<th>Canal Discord</th>
|
||||
<th>Message</th>
|
||||
<th>Dernière vidéo</th>
|
||||
<th>#</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -30,6 +31,17 @@
|
||||
</td>
|
||||
<td>{{alert.notify_channel_name}}</td>
|
||||
<td>{{alert.message[:50]}}{% if alert.message|length > 50 %}...{% endif %}</td>
|
||||
<td class="last-video">
|
||||
{% if alert.last_video_title %}
|
||||
<a href="https://www.youtube.com/watch?v={{alert.last_video_id}}" target="_blank" title="{{alert.last_video_title}}">
|
||||
{{alert.last_video_title[:40]}}{% if alert.last_video_title|length > 40 %}...{% endif %}
|
||||
</a>
|
||||
<br>
|
||||
<small>📅 {{alert.last_video_date.strftime('%d/%m/%Y à %H:%M') if alert.last_video_date else '-'}}</small>
|
||||
{% else %}
|
||||
<span class="no-video">Aucune vidéo détectée</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
<a href="{{ url_for('toggleYoutubeAlert', id = alert.id) }}" class="icon">{{ '✅' if alert.enable else '❌' }}</a>
|
||||
<a href="{{ url_for('openEditYoutubeAlert', id = alert.id) }}" class="icon">✐</a>
|
||||
|
||||
@@ -75,6 +75,8 @@ async def checkNewVideos(bot):
|
||||
await _notifyAlert(bot, alert, video)
|
||||
|
||||
alert.last_video_id = video.video_id
|
||||
alert.last_video_title = video.title
|
||||
alert.last_video_date = video.published
|
||||
else:
|
||||
logger.warning(f"Impossible de récupérer les vidéos pour {alert.channel_id}")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user