jillo-bot/delete-commands.cjs

17 lines
672 B
JavaScript

const fs = require("node:fs");
const { REST } = require("@discordjs/rest");
const { Routes } = require("discord-api-types/v9");
const {token} = require('./config.json');
const rest = new REST({ version: "9" }).setToken(token);
rest.get(Routes.applicationGuildCommands('898850107892596776', '587108210121506816')).then((data) => {
const promises = [];
for (const command of data) {
const deleteUrl = `${Routes.applicationGuildCommands('898850107892596776', '587108210121506816')}/${command.id}`;
promises.push(rest.delete(deleteUrl));
}
console.log(`Removing ${promises.length} commands...`);
Promise.all(promises).then(() => console.log('Done!'));
});