const path = require('node:path'); const { Routes } = require('discord.js'); const { REST } = require('@discordjs/rest'); const { clientId, guildId, token } = require(path.join(process.cwd(), 'config.json')); const rest = new REST({ version: '10' }).setToken(token); // for guild-based commands rest.put(Routes.applicationGuildCommands(clientId, guildId), { body: [] }) .then(() => console.log('Successfully deleted all guild commands.')) .catch(console.error); // for global commands rest.put(Routes.applicationCommands(clientId), { body: [] }) .then(() => console.log('Successfully deleted all application commands.')) .catch(console.error);