> ## 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.

# definePlugin()

> Function exported by @botmesh/core.

```ts theme={null}
function definePlugin<TConfig>(spec): PluginSpec<TConfig>;
```

Defined in: [plugins/definePlugin.ts:62](https://github.com/andresayac/botmesh/blob/main/packages/core/src/plugins/definePlugin.ts#L62)

Types a plugin spec (it returns `spec` unchanged). `install()` must be synchronous.

## Type Parameters

| Type Parameter | Default type |
| - | - |
|  `TConfig` | `Record`\<`string`, `unknown`> |

## Parameters

| Parameter | Type |
| - | - |
| `spec` | [`PluginSpec`](https://botmesh.afaya.com.co/api/core/interfaces/PluginSpec)\<`TConfig`> |

## Returns

[`PluginSpec`](https://botmesh.afaya.com.co/api/core/interfaces/PluginSpec)\<`TConfig`>

## Example

```ts theme={null}
const greeter = definePlugin<{ text?: string }>({
  name: 'greeter',
  version: '1.0.0',
  install({ bot }, config) {
    bot.when('hello', (ctx) => ctx.reply(config?.text ?? 'Hi!'))
  },
})

bot.plug(greeter, { text: 'Welcome!' })
```


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