mirror of
https://github.com/gabrielkheisa/discord-active-developer-badge.git
synced 2024-11-25 21:03:56 +07:00
30 lines
802 B
JavaScript
30 lines
802 B
JavaScript
|
const { createInterface } = require('node:readline');
|
||
|
const { Client, REST, Routes } = require('discord.js');
|
||
|
|
||
|
const client = new Client({ intents: [] });
|
||
|
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
||
|
|
||
|
|
||
|
client.on('interactionCreate', (interaction) => {
|
||
|
interaction.reply('yes');
|
||
|
});
|
||
|
|
||
|
const question = (q) => new Promise((resolve) => rl.question(q, resolve));
|
||
|
(async ()=>{
|
||
|
const token = await question('Application token? ');
|
||
|
if(!token) throw new Error('Invalid token');
|
||
|
|
||
|
await client.login(token).catch((err) => {
|
||
|
throw err
|
||
|
});
|
||
|
|
||
|
const rest = new REST({ version: '10' }).setToken(token);
|
||
|
await rest.put(Routes.applicationCommands(client.user.id), { body: [
|
||
|
{
|
||
|
name: 'ping',
|
||
|
description: 'yes'
|
||
|
}
|
||
|
] });
|
||
|
|
||
|
console.log('DONE');
|
||
|
})();
|