SlashCommandBuilder class Null safety

A slash command, can only be instantiated through a method on Interactions



SlashCommandBuilder(String name, String? description, List<CommandOptionBuilder> options, {bool canBeUsedInDm = true, int? requiredPermissions, Snowflake? guild, SlashCommandType type =, bool defaultPermissions = true, List<CommandPermissionBuilderAbstract>? permissions})
A slash command, can only be instantiated through a method on Interactions


canBeUsedInDm bool
Whether this slash command can be used in a DM channel with the bot.
defaultPermissions bool
If people can use the command by default or if they need permissions to use it.
@Deprecated('Use canBeUsedInDm and requiresPermissions instead'), final
description String?
Command description shown to the user in the Slash Command UI
guild Snowflake?
The guild that the slash Command is registered in. This can be null if its a global command.
read / write
handler SlashCommandHandler?
Handler for SlashCommandBuilder
read / write
hashCode int
The hash code for this object. [...]
read-only, inherited
id Snowflake
name String
Command name to be shown to the user in the Slash Command UI
options List<CommandOptionBuilder>
The arguments that the command takes
read / write
permissions List<CommandPermissionBuilderAbstract>?
Permission overrides for the command
@Deprecated('Use canBeUsedInDm and requiresPermissions instead'), read / write
requiredPermissions int?
A set of permissions required by users in guilds to execute this command. [...]
read / write
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
type SlashCommandType
Target of slash command if different that - slash command will become context menu in appropriate context
read / write


addPermission(CommandPermissionBuilderAbstract permission) → void
Register a permission
@Deprecated('Use canBeUsedInDm and requiresPermissions instead')
build() RawApiMap
Returns built response for api
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
registerHandler(SlashCommandHandler handler) → void
Registers handler for command. Note command cannot have handler if there are options present
setId(Snowflake id) → void
toString() String
A string representation of this object. [...]


operator ==(Object other) bool
The equality operator. [...]