PluginContext
- interface PluginContext<S>
What an installed plugin gets from the server that added it.
Type parameters
S – (extends PluginSettings)
Properties
Property
Type
Description
settingsReadonly<S>
Values the server owner chose, with manifest defaults filled in.
slugThe plugin’s slug from
plugin.toml.versionMethods
-
PluginContext.kv(name: string)
KVNamespace A KV store only this plugin uses. Keys live under
plugin:<slug>, orplugin:<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.
-
PluginContext.kv(name: string)