SlashCommandBuilder class

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

Inheritance

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.
read / write
handler SlashCommandHandler?
Handler for SlashCommandBuilder
read / write
hashCode int
The hash code for this object.
read-onlyinherited
id Snowflake
read-only
isNsfw bool?
Indicates whether the command is age-restricted, defaults to false.
read / write
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
read / write
permissions List<CommandPermissionBuilderAbstract>?
Permission overrides for the command
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-onlyinherited
type SlashCommandType
Target of slash command if different that SlashCommandTarget.chat - slash command will become context menu in appropriate context
read / write

Methods

addPermission(CommandPermissionBuilderAbstract permission) → void
Register a permission
build() RawApiMap
Returns built response for api
override
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