added proper modal handler and raidplan

This commit is contained in:
DeSqBlocki
2026-08-14 23:49:31 +02:00
parent 9e94e99874
commit dafa81e2a6
5 changed files with 1696 additions and 44 deletions
+60
View File
@@ -0,0 +1,60 @@
const fs = require("node:fs");
const path = require("node:path");
module.exports = (client) => {
const modalsPath = path.join(
__dirname,
"../modals"
);
if (!fs.existsSync(modalsPath)) {
console.log(
`[WARNING] Modal directory not found: ${modalsPath}`
);
return;
}
const modalFiles = fs
.readdirSync(modalsPath)
.filter(file =>
file.endsWith(".js")
);
let count = 0;
for (const file of modalFiles) {
const filePath = path.join(
modalsPath,
file
);
const modal = require(filePath);
if (
!modal.customId ||
typeof modal.execute !== "function"
) {
console.log(
`[WARNING] Modal ${file} is missing "customId" or "execute".`
);
continue;
}
client.modals.set(
modal.customId,
modal
);
console.log(
`[MODAL] Registered "${modal.customId}" from ${file}`
);
count++;
}
console.log(
`[${count}] Modal(s) initialized`
);
};