Hello, I wanted to know what is the best way to register slash commands?
Via the Rest API directly as in the guide?
https://discordjs.guide/interactions/slash-commands.html#guild-commands
Directly with the DiscordJS API?
public async registerCommands() : Promise<void> {
// Get command data :
const commands = this.commands.map(command => command.slashCommand.setDefaultPermission(false).toJSON());
// Get command manager :
if(!client.application?.owner) await client.application?.fetch();
const commandManager = (await client.guilds.fetch(guildId)).commands;
// Set commands and permissions :
const commandsInstances = await commandManager.set(commands);
for(const command of commandsInstances.values()){
const permissions = this.commands.get(command.name)?.permissions;
if(permissions) command.permissions.set({ permissions: permissions });
}
Logger.info("Successfully registered application commands");
}
Or another solution?