CommandGroup

implementsMiddlewareChainer<M, C>

Description

A group of Command, which will only match if the Matcher and a command in the group matches

Example

const group = new CommandGroup()
  .match(matchPrefixes("!"))
  .setCommands(sumCommand)

// Input: "!sum 2 2"
// Output: "The sum is: 4"

// Input: "!something"
// Output: nothing

// Input: "?sum 5 3"
// Output: nothing

Generics

M
Message
C
Client
D
Metadata
S

Properties

commands:
CommandLike<M, C>[]
metadata:
D
middleware:
Middleware<any, M, C>[]

Methods

match(matcher)CommandGroup<M, C, D, T & S>
Parameters
matcher:
Matcher<T & S, M, C>
setCommands(commands)this

Set the commands for this CommandGroup

Parameters
commands:
CommandLike<M, C>[]
setMetadata(data)CommandGroup<M, C, T, S>
Parameters
data:
T
use(middleware)CommandGroup<M, C, D, T & S>

Add Middleware. The order that you call this is the order the middleware will be in

Parameters
middleware:
Middleware<T & S, M, C>