# ContextMenuRoute

`function` in `core` · v0.1.4

<https://docs.seedcord.org/packages/core/0.1.4/functions/context-menu-route>

Routes one or more context-menu commands to a `ContextMenuHandler`.

Pass the kind (`ApplicationCommandType.User` or `ApplicationCommandType.Message`) and the command name(s), each checked against that kind's registry. A typo there is a compile error. The handler's generic must declare the same kind, cross-checked both directions. Context menus carry no options, so a multi-name handler reads `this.target` uniformly with no branch.

```ts
ContextMenuRoute<Kind>(
    kind: Kind,
    names: NamesFor<Kind>[]
): <TCtor extends AnyHandlerCtor>(
    constructor: AssertContextMenuRoute<Kind, TCtor>
) => void
```

Routes one or more context-menu commands to a `ContextMenuHandler`.

Pass the kind (`ApplicationCommandType.User` or `ApplicationCommandType.Message`) and the command name(s), each checked against that kind's registry. A typo there is a compile error. The handler's generic must declare the same kind, cross-checked both directions. Context menus carry no options, so a multi-name handler reads `this.target` uniformly with no branch.

Parameters.

- `kind` `Kind` — The context-menu kind, `ApplicationCommandType.User` or `ApplicationCommandType.Message`.
- `names` `NamesFor<Kind>[]` — The command name(s) this handler serves, keyed off the matching registry.

Returns `<TCtor extends AnyHandlerCtor>(constructor: AssertContextMenuRoute<Kind, TCtor>) => void`.
