Just import your own SlashCommandBuilder
instead of the one from discord.js. Then you can do this:
const meta = new SlashCommandBuilder()
.setName('sandwich')
.setDescription('Makes a sandwich')
.setIntegrationTypes(AppIntegrationType.GuildInstall, AppIntegrationType.UserInstall);
As per Discord spec, commands will only have the GuildInstall
integration type, if none specified.
Optionally, you can also specify interaction contexts:
const meta = new SlashCommandBuilder()
.setName('sandwich')
.setDescription('Makes a sandwich')
.setIntegrationTypes(AppIntegrationType.GuildInstall, AppIntegrationType.UserInstall)
.setContexts(InteractionContextType.Guild, InteractionContextType.BotDM);
As per Discord spec, commands will have all 3 interaction contexts. In this example, the command can be used in servers and in bot DMs, but not in any other DMs.
Nice work. But i cant figure out, how do you register those? Is there a diffrent method for this then
await client.application.commands.set(commands);