-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreset.js
35 lines (30 loc) · 894 Bytes
/
reset.js
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
const { REST, Routes } = require("discord.js");
const {
token_dev,
token_prod,
client_id_dev,
client_id_prod,
test_guild_id,
} = require("./config.json");
let token = [];
let client_id = [];
if (process.env.NODE_ENV === "production") {
console.log("Running in production mode");
token = token_prod;
client_id = client_id_prod;
} else {
console.log("Running in development mode");
token = token_dev;
client_id = client_id_dev;
}
const rest = new REST({ version: "9" }).setToken(token);
// for guild-based commands
rest
.put(Routes.applicationGuildCommands(client_id, test_guild_id), { body: [] })
.then(() => console.log("Successfully deleted all guild commands."))
.catch(console.error);
// for global commands
rest
.put(Routes.applicationCommands(client_id), { body: [] })
.then(() => console.log("Successfully deleted all application commands."))
.catch(console.error);