Skip to content

@bight-ts/plugin-ops

import {
createErrorReporterPlugin,
createMaintenanceModePlugin,
createStartupChecksPlugin,
} from "@bight-ts/plugin-ops";

Validates environment variables, intents, and services before the bot connects to Discord.

PropertyTypeRequiredDescription
requiredEnvstring[]NoEnvironment variables that must be defined
requiredIntentsGatewayIntentBits[]NoIntents that must be present on the client
requiredServices{ name, get }[]NoService accessors to check for truthiness
mode"fail" | "warn"NoWhether to throw or just log warnings. Defaults to "fail"
enabledbooleanNoToggle the plugin

Injects a global precondition that blocks all interactions when active.

PropertyTypeRequiredDescription
getState(context) => Promise<{ active: boolean }>YesReads the current maintenance state
setState(context, state) => Promise<void>YesPersists a new maintenance state
includeCommandbooleanNoRegister a /maintenance toggle command. Defaults to false
allowedUserIdsstring[]NoUser IDs that bypass maintenance mode
messagestringNoCustom denial message
enabledbooleanNoToggle the plugin

Subscribes to diagnostic events and forwards errors to an external reporter.

PropertyTypeRequiredDescription
getReporter(context) => ErrorReporterYesReturns your error reporting service
includeCommandErrorsbooleanNoForward command errors. Defaults to true
includeInteractionErrorsbooleanNoForward interaction errors. Defaults to true
includeTaskFailuresbooleanNoForward scheduled task failures. Defaults to true
enabledbooleanNoToggle the plugin