Maintenance Mode
The @bight-ts/plugin-ops maintenance mode plugin injects a global precondition that blocks all incoming commands, buttons, and interactions when activated. Designated developers can bypass the block to verify fixes while users receive a configurable denial message.
import { createMaintenanceModePlugin } from "@bight-ts/plugin-ops";
export const maintenanceModePlugin = createMaintenanceModePlugin({ getState: async (context) => context.services.settings.getMaintenanceState(),
setState: async (context, state) => { await context.services.settings.setMaintenanceState(state); },
// Registers a /maintenance toggle command (default: false) includeCommand: true,});Add to src/plugins/index.ts.
How it works
Section titled “How it works”When maintenance mode is active:
-
Every incoming interaction hits the global precondition.
-
The precondition checks the state via
getState(). -
If active, the routing pipeline halts before
execute()is reached. -
The user receives a denial message. Developers on the allow-list bypass the check.
Because the toggle persists through your settings or storage layer, maintenance mode survives bot restarts.