Route
interface in meocord/common Since 4.1.0
interface Route<T extends string = string>A component's customId pattern with a typed build, as route makes it.
Pass it to @Command in place of the pattern's text, and build the customIds that reach its handler.
Members
pattern
readonly pattern: TThe pattern, as written.
build
build(
...values: [RouteParams<T>] extends [never] ? [] : [values: RouteValues<T>]
): stringA customId this route matches, with each param's value in its segment. / and % in a value are
encoded, and the handler receives the value as it was given.
Parameters
| Name | Type | Description |
|---|---|---|
...values | [RouteParams<T>] extends [never]
? []
: [values: RouteValues<T>] |
Returns
stringThrows
TypeError for a missing, empty or unknown value or one not of its param's type, and RangeError for an id over 100 characters.
toString
toString(): TThe pattern, so a route reads as its pattern in a template string.
Returns
T