From 891cf0ecdad9a1a78fdf5d127a60bdcc8e54ae5c Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Thu, 15 Feb 2024 20:19:36 -0500 Subject: Deploy command changes; Filter bots on vote; Fixed status --- deploy-command.js | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'deploy-command.js') diff --git a/deploy-command.js b/deploy-command.js index fd9de7a..0b57507 100644 --- a/deploy-command.js +++ b/deploy-command.js @@ -1,6 +1,5 @@ import fs, { readFileSync } from 'node:fs'; -import { REST } from '@discordjs/rest'; -import { Routes } from 'discord-api-types/v10'; +import { REST, Routes } from 'discord.js'; // import config from './config.json' assert {type: 'json'} const { clientID, token } = JSON.parse(readFileSync('./config.json')); @@ -12,8 +11,22 @@ for (const file of commandFiles) { commands.push(command.data.toJSON()); } -const rest = new REST({ version: '10' }).setToken(token); +const rest = new REST().setToken(token); -rest.put(Routes.applicationCommands(clientID), { body: commands }) - .then(() => console.log('Successfully registered application commands.')) - .catch(console.error); +// and deploy your commands! +(async() => { + try { + console.log(`Started refreshing ${commands.length} application (/) commands.`); + + // The put method is used to fully refresh all commands in the guild with the current set + const data = await rest.put( + Routes.applicationCommands(clientID), + { body: commands } + ); + + console.log(`Successfully reloaded ${data.length} application (/) commands.`); + } catch (error) { + // And of course, make sure you catch and log any errors! + console.error(error); + } +})(); -- cgit v1.2.3