2021-11-18 18:56:42 +01:00
|
|
|
const fs = require("fs");
|
2022-03-02 19:37:05 +01:00
|
|
|
const cmds = [];
|
|
|
|
const ownercmds = [];
|
2021-09-17 18:28:39 +02:00
|
|
|
module.exports = async client => {
|
2021-11-18 18:56:42 +01:00
|
|
|
fs.readdirSync("./events").forEach(file => {
|
|
|
|
require(`${process.cwd()}/events/${file}`);
|
2021-09-17 18:28:39 +02:00
|
|
|
});
|
2021-11-18 18:56:42 +01:00
|
|
|
fs.readdirSync("./command").forEach(directory => {
|
|
|
|
if (directory !== "Owner") {
|
|
|
|
const commands = fs.readdirSync(`./command/${directory}/`);
|
|
|
|
commands.map(value => {
|
|
|
|
const file = require(`${process.cwd()}/command/${directory}/${value}`);
|
|
|
|
if (file.name) {
|
|
|
|
const properties = { directory, ...file };
|
|
|
|
client.slashCommands.set(file.name, properties);
|
|
|
|
}
|
|
|
|
if (["MESSAGE", "USER"].includes(file.type)) delete file.description;
|
|
|
|
if (file.UserPerms) file.defaultPermission = false;
|
|
|
|
cmds.push(file);
|
|
|
|
});
|
2021-09-17 18:28:39 +02:00
|
|
|
}
|
|
|
|
});
|
2021-11-18 18:56:42 +01:00
|
|
|
fs.readdirSync("./command/Owner").forEach(f => {
|
|
|
|
const file = require(`${process.cwd()}/command/Owner/${f}`);
|
2021-09-17 18:28:39 +02:00
|
|
|
client.hide.set(file.name, file);
|
|
|
|
if (["MESSAGE", "USER"].includes(file.type)) delete file.description;
|
2021-11-18 18:56:42 +01:00
|
|
|
if (file.UserPerms) file.defaultPermission = false;
|
2021-09-17 18:28:39 +02:00
|
|
|
ownercmds.push(file);
|
|
|
|
});
|
|
|
|
client.on("ready", async () => {
|
2022-03-02 15:37:01 +01:00
|
|
|
await client.guilds.cache.get("840225563193114624").commands.set(ownercmds);
|
2022-07-02 11:06:48 +02:00
|
|
|
await client.application.commands.set(cmds);
|
2021-09-17 18:28:39 +02:00
|
|
|
});
|
|
|
|
};
|