chore: 🎉 initial commit

This commit is contained in:
UltraLionFr
2025-08-26 01:01:34 +02:00
parent bf6d61e5a3
commit 30cfbd73fc
27 changed files with 1341 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
const { REST, Routes } = require("discord.js");
const { getCommandsJSON } = require("../../handlers/commandHandler");
const logger = require("../../handlers/logger");
module.exports = {
name: "clientReady",
once: true,
async execute(client) {
const commands = getCommandsJSON();
const rest = new REST({ version: "10" }).setToken(process.env.DISCORD_TOKEN);
try {
logger.info("⏳ Déploiement des slash commands...");
await rest.put(
Routes.applicationCommands(process.env.CLIENT_ID),
{ body: commands }
);
logger.success(`${commands.length} slash commands déployées avec succès !`);
} catch (error) {
logger.error(`❌ Erreur lors du déploiement des commandes : ${error.message}`);
}
}
};
+99
View File
@@ -0,0 +1,99 @@
const {
ActionRowBuilder,
ButtonBuilder,
ButtonStyle,
EmbedBuilder,
StringSelectMenuBuilder
} = require("discord.js");
const { config } = require("../../handlers/configLoader");
const logger = require("../../handlers/logger");
function parseColor(raw) {
if (!raw) return 0x5865F2;
if (typeof raw === "number") return raw;
if (typeof raw === "string") {
if (raw.startsWith("0x")) return parseInt(raw, 16);
if (raw.startsWith("#")) return parseInt(raw.slice(1), 16);
const asInt = parseInt(raw);
if (!isNaN(asInt)) return asInt;
}
return 0x5865F2;
}
module.exports = {
name: "clientReady",
once: true,
async execute(client) {
const panelConfig = config.TicketPanel.Panel;
const channelId = Array.isArray(panelConfig.Channel)
? panelConfig.Channel[0]
: panelConfig.Channel;
const channel = await client.channels.fetch(channelId).catch(() => null);
if (!channel) {
return logger.error("❌ Impossible de trouver le salon défini pour le panel de ticket.");
}
// === Embed principal ===
const embed = new EmbedBuilder()
.setTitle(panelConfig.Embed.Title || "")
.setDescription(panelConfig.Embed.Description || "")
.setColor(parseColor(panelConfig.Embed.Color));
if (panelConfig.Embed.PanelImage) embed.setImage(panelConfig.Embed.PanelImage);
if (panelConfig.Embed.CustomThumbnailURL) embed.setThumbnail(panelConfig.Embed.CustomThumbnailURL);
if (panelConfig.Embed.Timestamp) embed.setTimestamp();
if (panelConfig.Embed.Footer && panelConfig.Embed.Footer.Enabled) {
embed.setFooter({
text: panelConfig.Embed.Footer.Text || "",
iconURL: panelConfig.Embed.Footer.CustomIconURL || null
});
}
let row;
// === Gestion des interactions ===
if (panelConfig.InteractionType === "select" && panelConfig.SelectMenu) {
// 📌 Mode Select Menu
const menu = new StringSelectMenuBuilder()
.setCustomId("ticket_select")
.setPlaceholder(panelConfig.SelectMenu.Placeholder || "Choisis une option...");
for (const opt of panelConfig.SelectMenu.Options) {
const option = {
label: opt.Label,
value: opt.Value,
};
if (opt.Description) option.description = opt.Description;
if (opt.Emoji) option.emoji = opt.Emoji;
menu.addOptions(option);
}
row = new ActionRowBuilder().addComponents(menu);
} else {
// 📌 Mode Boutons par défaut
row = new ActionRowBuilder();
if (panelConfig.Buttons && Array.isArray(panelConfig.Buttons)) {
for (const btn of panelConfig.Buttons) {
row.addComponents(
new ButtonBuilder()
.setCustomId(btn.CustomId)
.setLabel(btn.Label)
.setStyle(ButtonStyle[btn.Style])
);
}
}
}
// === Nettoyage & envoi ===
await channel.bulkDelete(10).catch(() => {});
await channel.send({ embeds: [embed], components: [row] });
logger.success(`✅ Panel "${panelConfig.Name}" envoyé avec succès !`);
}
};
+9
View File
@@ -0,0 +1,9 @@
const logger = require("../../handlers/logger");
module.exports = {
name: "clientReady",
once: true,
execute(client) {
logger.success(`Connecté en tant que ${client.user.tag}`);
}
};