forked from PwLDev/CountryBotLegacy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.js
More file actions
36 lines (28 loc) · 1.05 KB
/
deploy.js
File metadata and controls
36 lines (28 loc) · 1.05 KB
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
30
31
32
33
34
35
36
import { APIRequest } from "./utils/APIRequest.js";
import fs from "node:fs";
import path from "node:path";
var availableCommands = new Array();
var disallowedCommands = ["config", "afk", "edit"];
fs.readdirSync(path.resolve("./commands/")).filter(f => f.endsWith(".js"))
.forEach(async file => {
const { default: command } = await import(`./commands/${file}`);
if (!command.data) return;
if (command.data.name === "spawn") return;
availableCommands.push(command.data)
});
setTimeout(() => {
try {
console.log("Updating Slash Commands...\nThis will take a while, please wait.");
availableCommands.forEach(cmd => {
if (disallowedCommands.includes(cmd.name)) cmd["dm_permission"] = false;
else cmd["dm_permission"] = true;
});
APIRequest("/applications/1090811431391334520/commands", {
method: "PUT",
body: availableCommands
})
console.info("Updated", availableCommands.length, "commands.")
} catch (error) {
throw new Error(error)
}
}, 1000)