-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathslashcommands.js
More file actions
29 lines (24 loc) · 853 Bytes
/
slashcommands.js
File metadata and controls
29 lines (24 loc) · 853 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
const fs = require("node:fs");
const path = require("node:path");
const { REST, Routes } = require("discord.js");
const {momoToken, momoID} = require("./config.json");
const commands = [];
const slashcommandsFiles = fs.readdirSync(`./Slashcmd`).forEach((subcarpetas) => {
const slashcommandsFiles = fs.readdirSync(`./Slashcmd/${subcarpetas}`).filter((file) => file.endsWith("js"));
for (const file of slashcommandsFiles) {
const slash = require(`./Slashcmd/${subcarpetas}/${file}`);
commands.push(slash.data.toJSON());
}
});
const rest = new REST({ version: "10" }).setToken(momoToken);
async function createSlash() {
try {
await rest.put(Routes.applicationCommands(momoID), {
body: commands
});
console.log(`💭 [INFO]: momo slashCommands Loaded`);
} catch (e) {
console.error(e);
}
}
createSlash();