Skip to content

Commit

Permalink
harder, faster, better, stronger (SudhanPlayz#869)
Browse files Browse the repository at this point in the history
  • Loading branch information
Neko-Life authored Jun 9, 2022
1 parent a3fc74d commit a587e47
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions deploy/destroy.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ const readline = require("readline");
const { REST } = require("@discordjs/rest");
const { Routes } = require("discord-api-types/v9");
const getConfig = require("../util/getConfig");
const LoadCommands = require("../util/loadCommands");

const rl = readline.createInterface({
input: process.stdin,
Expand All @@ -14,25 +13,26 @@ const rl = readline.createInterface({
const config = await getConfig();
const rest = new REST({ version: "9" }).setToken(config.token);

rl.question(
if (!process.argv.includes("--global")) rl.question(
"Enter the guild id you wanted to delete commands: ",
async (guild) => {
console.log("Evil bot has been started to delete commands...");
let commands = await rest.get(
Routes.applicationGuildCommands(config.clientId, guild)
);
for (let i = 0; i < commands.length; i++) {
const cmd = commands[i];
await rest
.delete(
Routes.applicationGuildCommand(config.clientId, guild, cmd.id)
)
.catch(console.log);
console.log("Deleted command: " + cmd.name);
}
if (commands.length === 0)
console.log("Evil bot doesn't seen any commands to delete :c");
await rest
.put(Routes.applicationGuildCommands(config.clientId, guild), {
body: [],
})
.catch(console.log);
console.log("Evil bot has done the deed, exiting...");
rl.close();
}
);
); else {
console.log("Evil bot has been started to delete global commands...");
await rest
.put(Routes.applicationCommands(config.clientId), {
body: [],
})
.catch(console.log);
console.log("Evil bot has done the deed, exiting...");
process.exit();
}
})();

0 comments on commit a587e47

Please sign in to comment.