RouteMatch
type alias in meocord/common Since 4.3.0
type RouteMatch<T extends string> = {
[S in RouteParamSpecs<T> as S['name']]: S['type'] extends 'string'
? string
: SegmentValue<S['type']>
}The params a customId route gives its handler, one for each of its params, as Route.match reads them.
An untyped param is its text, int and number are numbers, bool is a boolean, snowflake and uuid are
text, and words to choose from, such as {order:asc|desc}, are the word. A pattern without params gives an empty
object. It also types a handler's params, or a helper that receives them, as ParamsOf does for a message pattern.
Examples
const closeTicket = route('ticket/{id:int}/close')
// { id: number }
type CloseParams = RouteMatch<typeof closeTicket.pattern>
@Command(closeTicket, CommandType.BUTTON)
async close(interaction: ButtonInteraction, { id }: CloseParams) {
await interaction.reply(`Closed ticket #${id}.`)
}