From 349b2e6ddb870e6228474871effc45390c911d1b Mon Sep 17 00:00:00 2001 From: alwayscompiling Date: Sun, 19 Jun 2022 17:04:31 -0400 Subject: [PATCH] Adding deploy commands. --- deploy-commands.js | 17 +++++++++++++++++ index.js | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 deploy-commands.js diff --git a/deploy-commands.js b/deploy-commands.js new file mode 100644 index 0000000..98e7f13 --- /dev/null +++ b/deploy-commands.js @@ -0,0 +1,17 @@ +const { SlashCommandBuilder } = require('@discordjs/builders'); +const { REST } = require('@discordjs/rest'); +const { Routes } = require('discord-api-types/v9'); +const { clientId, guildId, token } = require('./config.json'); + +const commands = [ + new SlashCommandBuilder().setName('ping').setDescription('Replies with pong!'), + new SlashCommandBuilder().setName('server').setDescription('Replies with server info!'), + new SlashCommandBuilder().setName('user').setDescription('Replies with user info!'), +] + .map(command => command.toJSON()); + +const rest = new REST({ version: '9' }).setToken(token); + +rest.put(Routes.applicationGuildCommands(clientId, guildId), { body: commands }) + .then(() => console.log('Successfully registered application commands.')) + .catch(console.error); \ No newline at end of file diff --git a/index.js b/index.js index 0d73a0b..c22c368 100644 --- a/index.js +++ b/index.js @@ -7,7 +7,7 @@ const client = new Client({ intents: [Intents.FLAGS.GUILDS] }); // When the client is ready, run this code (only once) client.once('ready', () => { - console.log('Ready!'); + console.log('Ready!'); }); // Login to Discord with your client's token