deploy-commands.js (view raw)
1const { SlashCommandBuilder, Routes } = require('discord.js');
2const { REST } = require('@discordjs/rest');
3const { clientId, token } = require('./config.json');
4
5const commands = [
6 new SlashCommandBuilder().setName('outro').setDescription('Leave voice channel with an outro.'),
7]
8 .map(command => command.toJSON());
9
10const rest = new REST({ version: '10' }).setToken(token);
11
12/*
13rest.put(Routes.applicationGuildCommands(clientId, guildId), { body: commands })
14 .then((data) => console.log(`Successfully registered ${data.length} application commands.`))
15 .catch(console.error);
16 */
17rest.put(Routes.applicationCommands(clientId), { body: commands })
18 .then((data) => console.log(`Successfully registered ${data.length} application commands.`))
19 .catch(console.error);