all repos — simple-discord-music-bot @ 97d143480c5e930b650d03144851f59a790715c6

A Discord bot making use of discord.js and play-yt.

tools/delete-commands.js (view raw)

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