SlashCommandBuilder class

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

Constructors

SlashCommandBuilder(String name, String? description, List<CommandOptionBuilder> options, {bool canBeUsedInDm = true, int? requiredPermissions, Snowflake? guild, SlashCommandType type = SlashCommandType.chat, @Deprecated('Use canBeUsedInDm and requiredPermissions instead') bool defaultPermissions = true, @Deprecated('Use canBeUsedInDm and requiredPermissions instead') List<CommandPermissionBuilderAbstract>? permissions, Map<Locale, String>? localizationsName, Map<Locale, String>? localizationsDescription, bool? isNsfw})
A slash command, can only be instantiated through a method on IInteractions

Properties

canBeUsedInDm bool
Whether this slash command can be used in a DM channel with the bot.
final
defaultPermissions bool
If people can use the command by default or if they need permissions to use it.
final
description String?
Command description shown to the user in the Slash Command UI
final
guild ↔ Snowflake?
The guild that the slash Command is registered in. This can be null if its a global command.
getter/setter pair
handler SlashCommandHandler?
Handler for SlashCommandBuilder
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
id → Snowflake
no setter
isNsfw bool?
Indicates whether the command is age-restricted, defaults to false.
getter/setter pair
localizationsDescription Map<Locale, String>?
The command descriptions to be shown to the user in the Slash Command UI by specified locales. See the available locales for a list of available locales. The key is the locale and the value is the description of the command in that locale. Values follow the same constraints as description.
final
localizationsName Map<Locale, String>?
The command names to be shown to the user in the Slash Command UI by specified locales. See the available locales for a list of available locales. The key is the locale and the value is the name of the command in that locale. Values follow the same constraints as name (^[\w-]{1,32}$).
final
name String
Command name to be shown to the user in the Slash Command UI
final
options List<CommandOptionBuilder>
The arguments that the command takes
getter/setter pair
permissions List<CommandPermissionBuilderAbstract>?
Permission overrides for the command
getter/setter pair
requiredPermissions int?
A set of permissions required by users in guilds to execute this command.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
type SlashCommandType
Target of slash command if different that SlashCommandTarget.chat - slash command will become context menu in appropriate context
getter/setter pair

Methods

addPermission(CommandPermissionBuilderAbstract permission) → void
Register a permission
build() → RawApiMap
Returns built response for api
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
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.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited