delete-commands.js (view raw)
1const { REST } = require('@discordjs/rest');
2const { Routes } = require('discord.js');
3const { clientId, guildId, token } = require('./config.json');
4
5const rest = new REST({ version: '10' }).setToken(token);
6
7// ...
8
9// for guild-based commands
10rest.put(Routes.applicationGuildCommands(clientId, guildId), { body: [] })
11 .then(() => console.log('Successfully deleted all guild commands.'))
12 .catch(console.error);
13
14// for global commands
15rest.put(Routes.applicationCommands(clientId), { body: [] })
16 .then(() => console.log('Successfully deleted all application commands.'))
17 .catch(console.error);