Skip to main content

Class: SubCommandEntryMethod<ArgType, CommandType>

@sapphire/plugin-subcommands.SubCommandEntryMethod

SubCommandEntryMethods support method names as subcommand functions. All methods must be on the same class. For splitting sub-commands into different commands, see SubCommandEntryCommand

example

export class extends SubCommandPluginCommand {
public constructor(context: PieceContext) {
super(context, {
name: 'conf',
// by default, outputs default to inputs
subCommands: ['set', { input: 'list', default: true }]
})
}

public async set(message: Message, args: Args) {
// !conf set is called here.
}

public async list(message: Message, args: Args) {
// !conf list is called here.
// !conf is also called here. (see SubCommandEntry.default)
}
}

Type parameters

NameType
ArgTypeextends Args = Args
CommandTypeextends Command<ArgType> = Command<ArgType>

Hierarchy

Constructors

constructor

โ€ข new SubCommandEntryMethod<ArgType, CommandType>(options)

Type parameters

NameType
ArgTypeextends Args<ArgType> = Args
CommandTypeextends Command<ArgType, CommandOptions, CommandType> = Command<ArgType, CommandOptions>

Parameters

NameType
optionsOptions<ArgType, CommandType>

Inherited from

SubCommandEntry.constructor

Defined in

projects/plugins/packages/subcommands/src/lib/SubCommandEntry.ts:15

Properties

input

โ€ข Readonly input: string | (context: MessageRunContext<ArgType, CommandType>) => Awaitable<string>

Inherited from

SubCommandEntry.input

Defined in

projects/plugins/packages/subcommands/src/lib/SubCommandEntry.ts:12


output

โ€ข Readonly output: string

Inherited from

SubCommandEntry.output

Defined in

projects/plugins/packages/subcommands/src/lib/SubCommandEntry.ts:13

Methods

match

โ–ธ match(value, context): Promise<boolean>

Parameters

NameType
valuestring
contextMessageRunContext<ArgType, CommandType>

Returns

Promise<boolean>

Inherited from

SubCommandEntry.match

Defined in

projects/plugins/packages/subcommands/src/lib/SubCommandEntry.ts:21


messageRun

โ–ธ messageRun(context): unknown

Parameters

NameType
contextMessageRunContext<ArgType, CommandType>

Returns

unknown

Overrides

SubCommandEntry.messageRun

Defined in

projects/plugins/packages/subcommands/src/lib/SubCommandEntryMethod.ts:33