PluginContext

interface PluginContext<S>

What an installed plugin gets from the server that added it.

Type parameters

S – (extends PluginSettings)

Properties

Property

Type

Description

settings

Readonly<S>

Values the server owner chose, with manifest defaults filled in.

slug

string

The plugin’s slug from plugin.toml.

version

string

Methods

PluginContext.kv(name: string) → KVNamespace

A KV store only this plugin uses. Keys live under plugin:<slug>, or plugin:<slug>:<name> when a name is given.

PluginContext.on(event: “CHANNEL_CREATE”, handler: (channel: AnyGuildChannel) => Promise<unknown>)

Same as discord.on, but an error in the handler is logged instead of stopping other handlers.

Parameters:
  • event: One of the events.* constants identifying the gateway event.

  • handler: Async callback invoked when the event fires. Signature varies by event.