aboutsummaryrefslogtreecommitdiff
path: root/deploy-command.js
diff options
context:
space:
mode:
authorAndrew Lee <alee14498@protonmail.com>2024-02-15 20:19:36 -0500
committerAndrew Lee <alee14498@protonmail.com>2024-02-15 20:19:36 -0500
commit891cf0ecdad9a1a78fdf5d127a60bdcc8e54ae5c (patch)
tree645affdddeadca3a470a0d8385d28d7d09696a53 /deploy-command.js
parentec7a6d2cd4b0d25251d5e9691a148a2b07984509 (diff)
downloadDLAP-891cf0ecdad9a1a78fdf5d127a60bdcc8e54ae5c.tar.gz
DLAP-891cf0ecdad9a1a78fdf5d127a60bdcc8e54ae5c.tar.bz2
DLAP-891cf0ecdad9a1a78fdf5d127a60bdcc8e54ae5c.zip
Deploy command changes; Filter bots on vote; Fixed status
Diffstat (limited to 'deploy-command.js')
-rw-r--r--deploy-command.js25
1 files changed, 19 insertions, 6 deletions
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);
+ }
+})();