Back to APIs list![mattx avatar](https://secure.gravatar.com/avatar/3c59454fff398b873d1a51058ccdd264&d=identicon)
Discord API examples & templates
Use these vals as a playground to view and fork Discord API examples and templates on Val Town. Run any example below or find templates that can be used as a pre-built solution.
register_discord_commands
@mattx
Script
register_discord_commands Registers slash commands for your Discord bot, globally or in one guild. Note that this overwrites old commands. app_id: Your bot's application ID as a string guild_id: Provide a guild ID as a string to apply the commands only in one guild, or use null to apply globally. Note that applying commands globally takes a while on Discord's end. token: Your bot's token. commands: An array of command objects to register. For a basic command with no arguments, only name and description are needed.