Skip to content

Zumito Config

This guide will help you to understand the zumito.config.ts file.

The zumito.config.ts file must export a constant named config that implements the LauncherConfig interface.

import type { LauncherConfig } from 'zumito-framework';
export const config: LauncherConfig = {
// Your configuration here
};

The LauncherConfig extends Partial<FrameworkSettings>, so all settings are defined at the top level of the exported config object. The main properties are:

  • discordClientOptions: Discord client configuration (token, intents, clientId).
  • defaultPrefix: Default bot prefix for text commands.
  • database: zumito-db multi-driver configuration.
  • bundles: An array of Bundle objects to load external modules.

Bundles are a way to organize your bot’s code. Each bundle is a directory that contains commands, events, and other modules.

To add a bundle, you need to add a Bundle object to the bundles array in your zumito.config.ts file.

import path from 'path';
import type { LauncherConfig } from 'zumito-framework';
const __dirname = process.cwd();
export const config: LauncherConfig = {
bundles: [{
path: path.join(__dirname, "node_modules", "@zumito-team", "admin-module"),
}, {
path: path.join(__dirname, "node_modules", "@zumito-team", "user-panel-module"),
}],
};

The zumito.config.ts file exports a LauncherConfig object. Framework settings are defined at the top level of the config (not nested):

import type { LauncherConfig } from 'zumito-framework';
export const config: LauncherConfig = {
discordClientOptions: {
intents: 3276799,
token: process.env.DISCORD_TOKEN!,
clientId: process.env.DISCORD_CLIENT_ID!,
},
defaultPrefix: process.env.BOT_PREFIX || "z-",
logLevel: parseInt(process.env.LOG_LEVEL || "3"),
};

The database property configures zumito-db:

export const config: LauncherConfig = {
mongoQueryString: process.env.MONGO_URI!,
database: {
default: 'mongo',
drivers: {
mongo: { uri: process.env.MONGO_URI! },
},
migrations: [], // optional: array of Migration instances
},
models: [Guild, Member], // auto-register models on startup
};
PropertyTypeDescription
database.defaultstringDefault driver name ('mongo', 'sqlite', 'tingo', 'memory')
database.driversRecord<string, object>Per-driver connection config
database.migrationsMigration[]Optional migration classes
modelsany[]Model classes to auto-register