-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeleteg.js
More file actions
22 lines (20 loc) · 872 Bytes
/
deleteg.js
File metadata and controls
22 lines (20 loc) · 872 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
const { REST, Routes } = require('discord.js');
require('dotenv').config();
const rest = new REST({ version: '10' }).setToken(process.env.DISCORD_TOKEN);
(async () => {
try {
console.log('Fetching current guild (/) commands...');
const commands = await rest.get(Routes.applicationGuildCommands(process.env.CLIENT_ID, process.env.GUILD_ID));
if (commands.length === 0) {
console.log('No guild commands to delete.');
return;
}
for (const command of commands) {
await rest.delete(`${Routes.applicationGuildCommands(process.env.CLIENT_ID, process.env.GUILD_ID)}/${command.id}`);
console.log(`Deleted guild command: ${command.name}`);
}
console.log('All guild commands deleted.');
} catch (error) {
console.error(error);
}
})();