Creating your first slash command
Before starting:
Global commands are available on all your app's guilds. Global commands are cached for 1 hour. That means that new global commands will fan out slowly across all guilds, and will be guaranteed to be updated in an hour.
Reference: https://bit.ly/3nGQrqF
Simple Slash Command
To create a slash command works a little differently, but following the same logic. Let's start with something basic.
Remember, you must name the constant as command, otherwise the TypeError: Cannot read properties of undefined
error will be returned.
You can register slash commands globally or per guilds. See below for ways to register commands:
Advanced Slash Command
The way that the slash commands work with options/arguments is different and better for the user to see, as the options are presented as soon as they start typing in the chat. See below how to add options and use their user-submitted values.
Adding permissions
Last updated