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
+36
View File
@@ -0,0 +1,36 @@
const fs = require("fs");
const path = require("path");
const { Collection } = require("discord.js");
function loadButtons(client) {
const interactionsPath = path.join(__dirname, "../interactions");
client.buttons = new Collection();
if (!fs.existsSync(interactionsPath)) return client.buttons;
const files = fs.readdirSync(interactionsPath).filter(f => f.endsWith(".js"));
for (const file of files) {
const button = require(path.join(interactionsPath, file));
if (button.id) {
client.buttons.set(button.id, button);
}
}
return client.buttons;
}
async function handleButton(interaction, client) {
const button = client.buttons.get(interaction.customId);
if (button) return button.execute(interaction, client);
for (const btn of client.buttons.values()) {
if (btn.id instanceof RegExp && btn.id.test(interaction.customId)) {
return btn.execute(interaction, client);
}
}
}
module.exports = { loadButtons, handleButton };