Plugin
Base class for an HTTP plugin, binding this.core to the HTTP Core.
To run on either transport, extend the base from @seedcord/core/plugin. Its this.core carries
only the shared members.
abstract class Plugin<
Opts extends HttpPluginOptions = { transport: "http" }
> extends Plugin<
Opts,
Core,
keyof typeof HTTP_SCOPE
>Member visibility
Filter class members by access level.
constructor
Constructs a new instance of the Plugin class
Plugin(
host: CoreBase,
[spec],
input: PluginSpecArgs<Opts, Fixed>
)Inherited from:Plugin
Showing members with Protected visibility and higher.
Opts
The transport and runtime the plugin declares.
Opts extends HttpPluginOptions = { transport: 'http'; }core
The host, typed to the transport whose Plugin base this class extends.
protected core: TCoreInherited from:Plugin
kv
This plugin's records in the bot's config.kv, stored under its attach key. Two attachments of
one plugin class each get their own records. Renaming the attach key leaves the records under
the old key behind.
logger
Logs under the plugin's class name, on the channel its attach key sets.
codegen()
Returns data that seedcord codegen writes into the bot's seedcord-gen.ts as a type.
Read it back with Generated<typeof YourPlugin>. Return plain data, or classes and objects
that a project file or your plugin's package exports. The class needs a static readonly id.
seedcord codegen calls this without running init(). Read only what the constructor stored
and the bot's files.
dispose()
Runs during teardown, in ShutdownPhase.Disconnect by default. seedcord skips it when init()
has thrown.
When init() outlasts its timeout, seedcord calls this once that init() resolves, outside any
shutdown phase. The process must still be alive for that call to happen.
dispose?(): Promisable<void>Inherited from:Plugin
init()
Runs in StartupPhase.Configuration by default.
Move it to a different phase with the PluginLifecycleSpec.
abstract init(): Promisable<void>Inherited from:Plugin
onHmr()
Override to reload plugin state on an HMR update.
onHmr(_event: HmrUpdateEvent): Promisable<void>Inherited from:Plugin
ready()
Runs in the Ready phase, after every attached plugin's init() has resolved. The other Ready
tasks run alongside it, including the http server binding its port.
Override it when your work needs a logged-in client or a resolved application id.
ready?(): Promisable<void>Inherited from:Plugin
registerCriticalFiles()
Registers critical file patterns that should trigger a full restart when changed in Dev HMR.
rejectOptions()
Rejects the options this plugin got.