Added delete commands script

This commit is contained in:
2023-12-04 11:23:27 +01:00
parent e0cf09c936
commit 0d3b01bbff
2 changed files with 21 additions and 0 deletions

View File

@@ -6,6 +6,7 @@
"scripts": { "scripts": {
"dev": "nodemon", "dev": "nodemon",
"dev:build": "node scripts/dev-deploy.js", "dev:build": "node scripts/dev-deploy.js",
"dev:delete": "node scripts/delete-commands.js",
"lint": "eslint_d src", "lint": "eslint_d src",
"lint:fix": "eslint_d --fix src", "lint:fix": "eslint_d --fix src",
"prod:build:global": "node scripts/deploy-commands.js --prod", "prod:build:global": "node scripts/deploy-commands.js --prod",

View File

@@ -0,0 +1,20 @@
const { REST, Routes } = require("discord.js")
require("dotenv").config()
const token = process.env.DEVTOKEN
const clientId = process.env.DEVID
const guildId = process.env.GUILDID
const rest = new REST({ version: "10" }).setToken(token)
async function deleteCommands() {
try {
console.log("Started deleting application (/) commands.")
await rest.put(
Routes.applicationGuildCommands(clientId, guildId),
{ body: [] },
)
console.log("Successfully deleted application (/) commands.")
} catch (error) {
console.error(error)
}
}
deleteCommands()