Skip to content
Spraxium

Primary navigation

Back to changelog
Spraxium 0.11.0, a new plugin system

Spraxium 0.11.0, a new plugin system

v0.11.0Latest

Register plugins by package name, publish slash commands to selected servers, and start with new CLI templates.

Spraxium 0.11.0 includes major changes to how plugins are configured and run. To enable an integration, put its package name under plugins in spraxium.config.ts. At startup, Core loads each plugin’s module, applies its defaults, and validates the options you supplied.

For a bot with buttons and scheduled jobs, you can use the Components defaults and set the São Paulo time zone for Schedule jobs that leave their own time zone unset.

snippet.ts
import { defineConfig } from '@spraxium/core';

export default defineConfig({
  plugins: {
    '@spraxium/components': {},

    '@spraxium/schedule': {
      timezone: 'America/Sao_Paulo',
    },
  },
});

To update a 0.10 bot, move the options you passed to helpers under the corresponding package keys. Core loads each plugin’s module from that configuration, so remove the imports that only served to activate those plugins. You can keep options in a separate file per package. Migration guide.

Community plugins follow the same process. Authors provide a module, an options schema, and a manifest. The CLI finds installed plugins through their manifests and uses package declarations to supply editor types. Run spraxium plugin sync to refresh those types. If two plugins declare the same ID, the logger names both and startup stops before the bot connects to Discord. Create a plugin.

Slash commands by server

You can also set the default destination for slash commands once per project. Set SLASH_GUILD_IDS in .env to one ID or a comma-separated list. With the variable unset, publication is global by default. An empty value raises a configuration error.

snippet.ts
import { defineConfig } from '@spraxium/core';

export default defineConfig({
  slash: {
    guilds: process.env.SLASH_GUILD_IDS,
  },
});

If you keep a test server, choose what goes there by folder or command class. Set the include and exclude rules alongside the server ID. Server publication examples.

New options for I18n, Webhook, and Signal Client

In I18n, you can configure pt-BR as a fallback for a missing pt-PT translation before using the default locale. Webhook lets you set which mentions a destination accepts and adjust that rule for an individual send. Signal Client can limit how long each send attempt waits for Discord. I18n · Webhook · Signal Client.

New CLI templates

The moderation-bot template includes /mod timeout and /mod untimeout. The welcome-bot template greets people when they join a server. Both are available in the CLI’s project selector.

snippet.sh
spraxium new my-bot

The HTTP template leaves the selector, and the deprecated package leaves the framework’s update workflow. CLI templates · RPC migration.