# SlashRoute

`function` in `core` · v0.6.0

<https://docs.seedcord.org/packages/core/0.6.0/functions/slash-route>

Routes one or more slash commands to a `SlashHandler`.

Pass the same route string(s) as the handler's generic. A single command reads `this.options`, several commands branch with `this.match`. The decorator routes and the generic must match exactly. Listing fewer or more than the handler declares is a compile error. Subcommands use a slash path.

```ts
SlashRoute<Route>(
    routes: Route[]
): <TCtor extends AnyHandlerCtor>(
    constructor: AssertSlashRoute<Route, TCtor>
) => void
```

Routes one or more slash commands to a `SlashHandler`.

Pass the same route string(s) as the handler's generic. A single command reads `this.options`, several commands branch with `this.match`. The decorator routes and the generic must match exactly. Listing fewer or more than the handler declares is a compile error. Subcommands use a slash path.

Parameters.

- `routes` `Route[]` — The route string(s) this handler serves, e.g. `'ban'`, `'ban', 'kick'`, or `'demo/setup'`.

Returns `<TCtor extends AnyHandlerCtor>(constructor: AssertSlashRoute<Route, TCtor>) => void`.
