# Interface: HashtagHandlerOptions (/pixi-vn-ink/index/interfaces/HashtagHandlerOptions)



Defined in: [src/handlers/interfaces/HashtagHandler.ts:69](https://github.com/DRincs-Productions/pixi-vn-ink/blob/5604a832025db23627dcf27e489490f9e7743d04/src/handlers/interfaces/HashtagHandler.ts#L69)

Configuration options for a Hashtag-Command handler registered via [HashtagCommands.add](/pixi-vn-ink/index/namespaces/HashtagCommands/functions/add).

## Properties [#properties]

### deprecated? [#deprecated]

\> `optional` **deprecated?**: `boolean`

Defined in: [src/handlers/interfaces/HashtagHandler.ts:103](https://github.com/DRincs-Productions/pixi-vn-ink/blob/5604a832025db23627dcf27e489490f9e7743d04/src/handlers/interfaces/HashtagHandler.ts#L103)

Whether this handler is deprecated. Deprecated handlers should still function correctly
but may be replaced by newer alternatives in the future.

***

### description? [#description]

\> `optional` **description?**: `string`

Defined in: [src/handlers/interfaces/HashtagHandler.ts:79](https://github.com/DRincs-Productions/pixi-vn-ink/blob/5604a832025db23627dcf27e489490f9e7743d04/src/handlers/interfaces/HashtagHandler.ts#L79)

An optional human-readable description of what this handler does.
Used for documentation purposes. Supports multi-line descriptions.

***

### keySchemas? [#keyschemas]

\> `optional` **keySchemas?**: `Record`\<`string` | `number`, `object`>

Defined in: [src/handlers/interfaces/HashtagHandler.ts:143](https://github.com/DRincs-Productions/pixi-vn-ink/blob/5604a832025db23627dcf27e489490f9e7743d04/src/handlers/interfaces/HashtagHandler.ts#L143)

JSON Schemas (usable with Ajv) for order-independent `<key> <value> [<value2> ...]` sections
embedded anywhere in the command's token list, keyed by the token that introduces the
section.

[validation](#validation) can only check the token list's own shape (fixed positions, or "any
number of trailing strings"); it can't express that everything after a given key must parse
into an object matching a specific JSON Schema. `keySchemas` fills that gap and — unlike
[validation](#validation) — is meant to be checked statically (by `vitePluginPixivn` / the VS Code
extension) without running the handler.

Each key in `keySchemas` is matched against the command's tokens from right to left: the
right-most occurrence of any known key starts a section that runs to the end of the
still-unprocessed tail; the scan then continues to its left for the next key, and so on.
Each section's tokens are converted to an object with the same `<key> <value>` pairing logic
as `convertListStringToObj` (passed to [HashtagHandler](/pixi-vn-ink/index/type-aliases/HashtagHandler)), then validated against that
key's schema.

#### Examples [#examples]

```ts
For the command `# wait hours 3 days tomorrow`, tokens are
`["wait", "hours", "3", "days", "tomorrow"]`. With
`keySchemas: { wait: { type: "object", properties: { hours: { type: "number" }, days: { type: "string" } } } }`,
the right-most (and only) match is `"wait"` at index 0; everything after it —
`{ hours: 3, days: "tomorrow" }` — is validated against that schema.
```

```ts
For `# show imagecontainer sly props xAlign 0.2 yAlign 1 movein direction right ease anticipate`
with `keySchemas: { props: propsSchema, movein: moveinSchema }`, the scan finds `"movein"`
first (right-most), validates `{ direction: "right", ease: "anticipate" }` against
`moveinSchema`, then continues left to `"props"` and validates
`{ xAlign: 0.2, yAlign: 1 }` against `propsSchema`.

A key can also be a number (or a digit-only string — object keys are always strings at
runtime). Numeric keys are checked only after every string key has already claimed its
section, largest to smallest, counting from `0` at the command's own leading literal (e.g.
`"show"`): key `N` claims `tokens[N .. end)` — `end` being the left edge of whatever the
previous (string or numeric) match already claimed — and the token right before it
(`tokens[N - 1]`, e.g. a dynamic alias no literal key could match) is dropped along with it.
See {@link InkHashtagCommandInfo.keySchemas} for a full worked example.
```

***

### name [#name]

\> **name**: `string`

Defined in: [src/handlers/interfaces/HashtagHandler.ts:74](https://github.com/DRincs-Productions/pixi-vn-ink/blob/5604a832025db23627dcf27e489490f9e7743d04/src/handlers/interfaces/HashtagHandler.ts#L74)

A unique name that identifies this handler.
Used for documentation and debugging purposes.

***

### validation [#validation]

\> **validation**: `RegExp` | `ZodType`\<`string`\[], `unknown`, `$ZodTypeInternals`\<`string`\[], `unknown`>>

Defined in: [src/handlers/interfaces/HashtagHandler.ts:98](https://github.com/DRincs-Productions/pixi-vn-ink/blob/5604a832025db23627dcf27e489490f9e7743d04/src/handlers/interfaces/HashtagHandler.ts#L98)

Determines whether this handler should be invoked for a given command.

* `RegExp` – the command tokens are joined with a space (`script.join(" ")`) and tested
  against the regular expression. The handler is invoked only if the regex matches.
* `ZodType<string[]>` – the command token array is validated with
  `schema.safeParse(script)`. The handler is invoked only if validation succeeds.

#### Example [#example]

```ts
// RegExp: only handle commands that start with "navigate"
validation: /^navigate\b/

// Zod: only handle commands whose first element is "navigate" and second is a non-empty string
import { z } from "zod"
validation: z.tuple([z.literal("navigate"), z.string().min(1)]).rest(z.string())
```
