mirror of
https://github.com/gabrielkheisa/discord-active-developer-badge.git
synced 2024-11-23 20:03:32 +07:00
add remote command script
This commit is contained in:
parent
fd3c3f9310
commit
1eb93ec5c0
27
remove-commands.js
Normal file
27
remove-commands.js
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
const { createInterface } = require('node:readline');
|
||||||
|
const { Client, Routes } = require('discord.js');
|
||||||
|
const commandNames = ['ping', 'command2', 'command3', 'command4'];
|
||||||
|
|
||||||
|
const client = new Client({ intents: [] });
|
||||||
|
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
||||||
|
|
||||||
|
const question = (q) => new Promise((resolve) => rl.question(q, resolve));
|
||||||
|
(async ()=>{
|
||||||
|
const token = await question('Application token? ');
|
||||||
|
|
||||||
|
await client.login(token);
|
||||||
|
const commands = await client.rest.get(Routes.applicationCommands(client.user.id));
|
||||||
|
|
||||||
|
const toBeRemoved = commands.filter((c) => commandNames.includes(c.name));
|
||||||
|
|
||||||
|
console.log('removing', toBeRemoved);
|
||||||
|
for (let i = 0; i < toBeRemoved.length; i++) {
|
||||||
|
const command = toBeRemoved[i];
|
||||||
|
await client.rest.delete(`/applications/${client.user.id}/commands/${command.id}`);
|
||||||
|
|
||||||
|
console.log('removed', command.id, command.name);
|
||||||
|
};
|
||||||
|
|
||||||
|
console.log('done');
|
||||||
|
process.exit();
|
||||||
|
})();
|
Loading…
Reference in New Issue
Block a user