SlashCommand
constSlashCommand:object
Defined in: packages/platform-discord/src/commands/slash-command.ts:633
The contract and implementation API for Discord slash commands.
Type Declaration
Section titled “Type Declaration”attachment
Section titled “attachment”attachment: {(
options):declare<DiscordAttachment,DiscordAttachment>; (options):optional<declare<DiscordAttachment,DiscordAttachment>>; (options):Codec<unknown>; }
Call Signature
Section titled “Call Signature”(
options):declare<DiscordAttachment,DiscordAttachment>
Parameters
Section titled “Parameters”options
Section titled “options”RequiredOptions<SlashCommandAttachmentOptionOptions>
Returns
Section titled “Returns”declare<DiscordAttachment, DiscordAttachment>
Call Signature
Section titled “Call Signature”(
options):optional<declare<DiscordAttachment,DiscordAttachment>>
Parameters
Section titled “Parameters”options
Section titled “options”OptionalOptions<SlashCommandAttachmentOptionOptions>
Returns
Section titled “Returns”optional<declare<DiscordAttachment, DiscordAttachment>>
Call Signature
Section titled “Call Signature”(
options):Codec<unknown>
Parameters
Section titled “Parameters”options
Section titled “options”SlashCommandAttachmentOptionOptions
Returns
Section titled “Returns”Codec<unknown>
boolean
Section titled “boolean”boolean: {(
options):Boolean; (options):optional<Boolean>; (options):Codec<unknown>; }
Call Signature
Section titled “Call Signature”(
options):Boolean
Parameters
Section titled “Parameters”options
Section titled “options”RequiredOptions<SlashCommandBooleanOptionOptions>
Returns
Section titled “Returns”Boolean
Call Signature
Section titled “Call Signature”(
options):optional<Boolean>
Parameters
Section titled “Parameters”options
Section titled “options”OptionalOptions<SlashCommandBooleanOptionOptions>
Returns
Section titled “Returns”optional<Boolean>
Call Signature
Section titled “Call Signature”(
options):Codec<unknown>
Parameters
Section titled “Parameters”options
Section titled “options”SlashCommandBooleanOptionOptions
Returns
Section titled “Returns”Codec<unknown>
channel
Section titled “channel”channel: {(
options):declare<DiscordChannel,DiscordChannel>; (options):optional<declare<DiscordChannel,DiscordChannel>>; (options):Codec<unknown>; }
Call Signature
Section titled “Call Signature”(
options):declare<DiscordChannel,DiscordChannel>
Parameters
Section titled “Parameters”options
Section titled “options”RequiredOptions<SlashCommandChannelOptionOptions>
Returns
Section titled “Returns”declare<DiscordChannel, DiscordChannel>
Call Signature
Section titled “Call Signature”(
options):optional<declare<DiscordChannel,DiscordChannel>>
Parameters
Section titled “Parameters”options
Section titled “options”OptionalOptions<SlashCommandChannelOptionOptions>
Returns
Section titled “Returns”optional<declare<DiscordChannel, DiscordChannel>>
Call Signature
Section titled “Call Signature”(
options):Codec<unknown>
Parameters
Section titled “Parameters”options
Section titled “options”SlashCommandChannelOptionOptions
Returns
Section titled “Returns”Codec<unknown>
integer
Section titled “integer”integer: {(
options):Int; (options):optional<Int>; (options):Codec<unknown>; }
Call Signature
Section titled “Call Signature”(
options):Int
Parameters
Section titled “Parameters”options
Section titled “options”RequiredOptions<SlashCommandNumberOptionOptions>
Returns
Section titled “Returns”Int
Call Signature
Section titled “Call Signature”(
options):optional<Int>
Parameters
Section titled “Parameters”options
Section titled “options”OptionalOptions<SlashCommandNumberOptionOptions>
Returns
Section titled “Returns”optional<Int>
Call Signature
Section titled “Call Signature”(
options):Codec<unknown>
Parameters
Section titled “Parameters”options
Section titled “options”SlashCommandNumberOptionOptions
Returns
Section titled “Returns”Codec<unknown>
make: {<
Name,Options,ComponentType>(name,config):ImplementedSlashCommand<Name,View<Options,"Type",TypeOptionalKeys<Options>,TypeMutableKeys<Options>>>; <Name,ComponentType>(name,config):ImplementedSlashCommand<Name, { }>; }
Call Signature
Section titled “Call Signature”<
Name,Options,ComponentType>(name,config):ImplementedSlashCommand<Name,View<Options,"Type",TypeOptionalKeys<Options>,TypeMutableKeys<Options>>>
Declares a complete Discord slash command.
SlashCommand.make is the whole definition: name, description, option
schemas, permissions, component, and app layer. Register the returned command
through the client’s commands option.
Option helpers (string, integer, …) declare Discord option metadata and
the params schema at the same time.
Type Parameters
Section titled “Type Parameters”Name extends string
Options
Section titled “Options”Options extends SlashCommandOptionFields
ComponentType
Section titled “ComponentType”ComponentType extends Any
Parameters
Section titled “Parameters”Name
config
Section titled “config”SlashCommandConfig<Options> & object & (View<Options, "Type", TypeOptionalKeys<Options>, TypeMutableKeys<Options>> extends Props<ComponentType> ? unknown : object)
Returns
Section titled “Returns”ImplementedSlashCommand<Name, View<Options, "Type", TypeOptionalKeys<Options>, TypeMutableKeys<Options>>>
Call Signature
Section titled “Call Signature”<
Name,ComponentType>(name,config):ImplementedSlashCommand<Name, { }>
Declares a complete Discord slash command.
SlashCommand.make is the whole definition: name, description, option
schemas, permissions, component, and app layer. Register the returned command
through the client’s commands option.
Option helpers (string, integer, …) declare Discord option metadata and
the params schema at the same time.
Type Parameters
Section titled “Type Parameters”Name extends string
ComponentType
Section titled “ComponentType”ComponentType extends Any
Parameters
Section titled “Parameters”Name
config
Section titled “config”SlashCommandConfig<{ }> & object & (object extends Props<ComponentType> ? unknown : object)
Returns
Section titled “Returns”ImplementedSlashCommand<Name, { }>
mentionable
Section titled “mentionable”mentionable: {(
options):Unknown; (options):optional<Unknown>; (options):Codec<unknown>; }
Call Signature
Section titled “Call Signature”(
options):Unknown
Parameters
Section titled “Parameters”options
Section titled “options”RequiredOptions<SlashCommandMentionableOptionOptions>
Returns
Section titled “Returns”Unknown
Call Signature
Section titled “Call Signature”(
options):optional<Unknown>
Parameters
Section titled “Parameters”options
Section titled “options”OptionalOptions<SlashCommandMentionableOptionOptions>
Returns
Section titled “Returns”optional<Unknown>
Call Signature
Section titled “Call Signature”(
options):Codec<unknown>
Parameters
Section titled “Parameters”options
Section titled “options”SlashCommandMentionableOptionOptions
Returns
Section titled “Returns”Codec<unknown>
number
Section titled “number”number: {(
options):Finite; (options):optional<Finite>; (options):Codec<unknown>; }
Call Signature
Section titled “Call Signature”(
options):Finite
Parameters
Section titled “Parameters”options
Section titled “options”RequiredOptions<SlashCommandNumberOptionOptions>
Returns
Section titled “Returns”Finite
Call Signature
Section titled “Call Signature”(
options):optional<Finite>
Parameters
Section titled “Parameters”options
Section titled “options”OptionalOptions<SlashCommandNumberOptionOptions>
Returns
Section titled “Returns”optional<Finite>
Call Signature
Section titled “Call Signature”(
options):Codec<unknown>
Parameters
Section titled “Parameters”options
Section titled “options”SlashCommandNumberOptionOptions
Returns
Section titled “Returns”Codec<unknown>
provide
Section titled “provide”provide: <
Name,Params>(command,layer) =>ImplementedSlashCommand<Name,Params>
Composes an application layer onto a command.
Type Parameters
Section titled “Type Parameters”Name extends string
Params
Section titled “Params”Params
Parameters
Section titled “Parameters”command
Section titled “command”ImplementedSlashCommand<Name, Params>
Layer<any, never, never>
Returns
Section titled “Returns”ImplementedSlashCommand<Name, Params>
role: {(
options):Unknown; (options):optional<Unknown>; (options):Codec<unknown>; }
Call Signature
Section titled “Call Signature”(
options):Unknown
Parameters
Section titled “Parameters”options
Section titled “options”RequiredOptions<SlashCommandRoleOptionOptions>
Returns
Section titled “Returns”Unknown
Call Signature
Section titled “Call Signature”(
options):optional<Unknown>
Parameters
Section titled “Parameters”options
Section titled “options”OptionalOptions<SlashCommandRoleOptionOptions>
Returns
Section titled “Returns”optional<Unknown>
Call Signature
Section titled “Call Signature”(
options):Codec<unknown>
Parameters
Section titled “Parameters”options
Section titled “options”SlashCommandRoleOptionOptions
Returns
Section titled “Returns”Codec<unknown>
string
Section titled “string”string: {(
options):String; (options):optional<String>; (options):Codec<unknown>; }
Call Signature
Section titled “Call Signature”(
options):String
Parameters
Section titled “Parameters”options
Section titled “options”RequiredOptions<SlashCommandStringOptionOptions>
Returns
Section titled “Returns”String
Call Signature
Section titled “Call Signature”(
options):optional<String>
Parameters
Section titled “Parameters”options
Section titled “options”OptionalOptions<SlashCommandStringOptionOptions>
Returns
Section titled “Returns”optional<String>
Call Signature
Section titled “Call Signature”(
options):Codec<unknown>
Parameters
Section titled “Parameters”options
Section titled “options”SlashCommandStringOptionOptions
Returns
Section titled “Returns”Codec<unknown>
user: {(
options):declare<DiscordUser,DiscordUser>; (options):optional<declare<DiscordUser,DiscordUser>>; (options):Codec<unknown>; }
Call Signature
Section titled “Call Signature”(
options):declare<DiscordUser,DiscordUser>
Parameters
Section titled “Parameters”options
Section titled “options”RequiredOptions<SlashCommandUserOptionOptions>
Returns
Section titled “Returns”declare<DiscordUser, DiscordUser>
Call Signature
Section titled “Call Signature”(
options):optional<declare<DiscordUser,DiscordUser>>
Parameters
Section titled “Parameters”options
Section titled “options”OptionalOptions<SlashCommandUserOptionOptions>
Returns
Section titled “Returns”optional<declare<DiscordUser, DiscordUser>>
Call Signature
Section titled “Call Signature”(
options):Codec<unknown>
Parameters
Section titled “Parameters”options
Section titled “options”SlashCommandUserOptionOptions
Returns
Section titled “Returns”Codec<unknown>