// Get the library Discord.JS const Discord = require("discord.js"); // Get prefix + token from config.json const { prefix, token } = require("./config.json"); const clientId = '877315883859603466'; const { SlashCommandBuilder } = require('@discordjs/builders'); const { REST } = require("@discordjs/rest"); const { Routes } = require("discord-api-types/v9"); const commands = [ new SlashCommandBuilder().setName('ping').setDescription('test slash command'), new SlashCommandBuilder().setName('test').setDescription('yet another test slash cmd'), ].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); // rest of the stuff here like logging in