const { SlashCommandBuilder, Routes } = require('discord.js'); const { REST } = require('@discordjs/rest'); 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!'), new SlashCommandBuilder().setName('outro').setDescription('Leave voice channel with an outro.'), ] .map(command => command.toJSON()); const rest = new REST({ version: '10' }).setToken(token); /* rest.put(Routes.applicationGuildCommands(clientId, guildId), { body: commands }) .then((data) => console.log(`Successfully registered ${data.length} application commands.`)) .catch(console.error); */ rest.put(Routes.applicationCommands(clientId), { body: commands }) .then((data) => console.log(`Successfully registered ${data.length} application commands.`)) .catch(console.error);