Skip to main content
Defined in: core/types.ts:238 A plugin: a name, a version and a synchronous install() that registers handlers through ctx.bot. Build one with definePlugin and plug it with bot.plug(plugin, config).

Type Parameters

Properties

name

Defined in: core/types.ts:239

version

Defined in: core/types.ts:240

description?

Defined in: core/types.ts:241

requires?

Defined in: core/types.ts:246 Names of plugins that must already be plugged (bot.plug() throws a descriptive error before install() runs otherwise). Checked at plug time only.

multiple?

Defined in: core/types.ts:253 Allow several instances of this plugin (same name) on one bot at a time, each with its own config and unplugged on its own. Default false: plugging a name that is already plugged throws, so a plugin registered twice by mistake never runs its handlers twice. Every instance must set it.

Methods

install()

Defined in: core/types.ts:262 Register the plugin’s handlers, hooks and tools. It must be synchronous and return nothing: bot.plug() does not await it. An async install (or one that returns a promise) does not compile (SyncInstallError names the reason); at runtime a rejected promise is still reported on the bot’s 'error' event, but the plugin is already considered installed and nothing is rolled back. Do async setup lazily on first use (the LazyProvider pattern in @botmesh/ai).

Parameters

Returns

| void | "Plugin.install() must be synchronous and return nothing: bot.plug() does not await it. Do async setup lazily on first use (LazyProvider in @botmesh/ai)."

uninstall()?

Defined in: core/types.ts:263

Parameters

Returns

void | Promise<void>