-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclear-commands.js
More file actions
28 lines (21 loc) · 1.04 KB
/
clear-commands.js
File metadata and controls
28 lines (21 loc) · 1.04 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
const { REST, Routes } = require('discord.js');
// Construct and prepare an instance of the REST module
const rest = new REST().setToken(process.env.TOKEN);
// and deploy your commands!
(async () => {
try {
console.log(`Started clearing global application (/) commands.`);
rest.put(Routes.applicationCommands(process.env.CLIENT_ID), { body: [] })
.then(() => console.log('Successfully deleted all application commands.'))
.catch(console.error);
console.log(`Successfully cleared global application (/) commands.`);
console.log(`Started clearing guild application (/) commands.`);
rest.put(Routes.applicationGuildCommands(process.env.CLIENT_ID, process.env.GUILD_ID), { body: [] })
.then(() => console.log('Successfully deleted all guild commands.'))
.catch(console.error);
console.log(`Successfully cleared guild application (/) commands.`);
} catch (error) {
// And of course, make sure you catch and log any errors!
console.error(error);
}
})();