Interface: SubcommandMappingMethod
@sapphire/plugin-subcommands.SubcommandMappingMethod
Describes how a subcommand method maps to the actual implementation of that subcommand.
Hierarchy
SubcommandMappingBase
↳
SubcommandMappingMethod
Properties
chatInputRun
• Optional
chatInputRun: string
| (interaction
: ChatInputCommandInteraction
<CacheType
>, context
: ChatInputCommandContext
) => unknown
The class method to call when invoking this subcommand through a chat input command, or a callback implementation of the subcommand.
Note that when providing a string you have to first define the method that will be called within your function before this will allow any values. This is to ensure that the property is strictly typed to the context of the class.
Example
chatInputRun: 'runModeratorConfig'
Example
chatInputRun(interaction: Subcommand.Interaction) {
return interaction.reply(`<@${interaction.user.id}> has been granted moderator`);
}
Defined in
projects/plugins/packages/subcommands/src/lib/SubcommandMappings.ts:79
default
• Optional
default: boolean
Whether this is the default subcommand when none is provided.
Note that this is effectively only used for Message based subcommand (those implementing messageRun) because the subcommand is always provided for chat input commands.
Defined in
projects/plugins/packages/subcommands/src/lib/SubcommandMappings.ts:37
messageRun
• Optional
messageRun: string
| (message
: Message
<boolean
>, args
: Args
, context
: MessageCommandContext
) => unknown
The class method to call when invoking this subcommand through a message command, or a callback implementation of the subcommand.
Note that when providing a string you have to first define the method that will be called within your function before this will allow any values. This is to ensure that the property is strictly typed to the context of the class.
Example
messageRun: 'runAdminConfig'
Example
messageRun(message: Message) {
return message.reply(`<@${message.author.id}> has been granted admin`);
}
Defined in
projects/plugins/packages/subcommands/src/lib/SubcommandMappings.ts:58
name
• name: string
The name of this subcommand, or subcommand group
Inherited from
SubcommandMappingBase.name
Defined in
projects/plugins/packages/subcommands/src/lib/SubcommandMappings.ts:14
type
• Optional
type: "method"
This subcommand mapping describes a subcommand method and can therefore only ever be 'method'
Overrides
SubcommandMappingBase.type
Defined in
projects/plugins/packages/subcommands/src/lib/SubcommandMappings.ts:29