> ## Documentation Index
> Fetch the complete documentation index at: https://botmesh.afaya.com.co/llms.txt
> Use this file to discover all available pages before exploring further.

# HookHandler<TCtx>

> Type alias exported by @botmesh/core.

```ts theme={null}
type HookHandler<TCtx> = (ctx, next) => void | Promise<void>;
```

Defined in: [core/types.ts:120](https://github.com/andresayac/botmesh/blob/main/packages/core/src/core/types.ts#L120)

A `before`/`after` hook: `(ctx, next)`. `before` hooks must call `next()` to let the event
through (returning without it stops the event, like `ctx.abort()`); `after` hooks receive
no usable `next`. The context type is inferred from the event name through
[HookContextMap](https://botmesh.afaya.com.co/api/core/interfaces/HookContextMap.md); for a custom event it is `unknown` unless the handler annotates it.

## Type Parameters

| Type Parameter | Default type |
| - | - |
|  `TCtx` | `unknown` |

## Parameters

| Parameter | Type |
| - | - |
| `ctx` | `TCtx` |
| `next` | () => `Promise`\<`void`> |

## Returns

`void` | `Promise`\<`void`>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.