feat(voice): add temporary voice channel manager

Joining the trigger channel must feel instant and never leave orphan channels behind, so the ownership is stored in SQLite, empty channels are deleted after a short grace period and a startup sweep cleans up whatever a restart left behind.
This commit is contained in:
BlackAngelTV committed 2026-09-15 14:51:17 +02:00
1 parent ef1bedbc65
commit 5191942d5a
12 files changed
+1277 -1

No files matched your search

+50 -1
View File
@@ -1,4 +1,4 @@
import { ActionRowBuilder, ButtonBuilder, ButtonStyle } from 'discord.js';
import { ActionRowBuilder, ButtonBuilder, ButtonStyle, UserSelectMenuBuilder } from 'discord.js';
/** Discord label and custom id limits. */
const LABEL_MAX = 80;
@@ -31,6 +31,55 @@ export function ticketButtons() {
];
}
/**
* Control panel posted in a temporary voice channel (M14-T05):
* buttons for the whole channel, select menus for a specific member.
*/
export function voicePanelComponents({ locked = false } = {}) {
return [
new ActionRowBuilder().addComponents(
new ButtonBuilder()
.setCustomId('voice:rename')
.setLabel('Renommer')
.setEmoji('✏️')
.setStyle(ButtonStyle.Secondary),
new ButtonBuilder()
.setCustomId('voice:limit')
.setLabel('Limiter')
.setEmoji('👥')
.setStyle(ButtonStyle.Secondary),
new ButtonBuilder()
.setCustomId('voice:lock')
.setLabel(locked ? 'Déverrouiller' : 'Verrouiller')
.setEmoji(locked ? '🔓' : '🔒')
.setStyle(locked ? ButtonStyle.Success : ButtonStyle.Secondary),
new ButtonBuilder()
.setCustomId('voice:claim')
.setLabel('Réclamer')
.setEmoji('👑')
.setStyle(ButtonStyle.Primary),
new ButtonBuilder()
.setCustomId('voice:delete')
.setLabel('Supprimer')
.setEmoji('🗑️')
.setStyle(ButtonStyle.Danger),
),
memberSelect('voice:permit', 'Autoriser un membre à rejoindre...'),
memberSelect('voice:kick', 'Exclure un membre du salon...'),
memberSelect('voice:transfer', 'Transférer la propriété du salon...'),
];
}
function memberSelect(customId, placeholder) {
return new ActionRowBuilder().addComponents(
new UserSelectMenuBuilder()
.setCustomId(customId)
.setPlaceholder(placeholder)
.setMinValues(1)
.setMaxValues(1),
);
}
/** One button per choice, 5 per row at most (M10-T02). */
export function pollButtons(pollId, choices) {
const rows = [];