Zumito Config
Esta página aún no está disponible en tu idioma.
This guide will help you to understand the zumito.config.ts file.
The LauncherConfig interface
Section titled “The LauncherConfig interface”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 ofBundleobjects to load external modules.
Bundles
Section titled “Bundles”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"), }],};Framework Settings
Section titled “Framework Settings”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"),};Database configuration
Section titled “Database configuration”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};| Property | Type | Description |
|---|---|---|
database.default | string | Default driver name ('mongo', 'sqlite', 'tingo', 'memory') |
database.drivers | Record<string, object> | Per-driver connection config |
database.migrations | Migration[] | Optional migration classes |
models | any[] | Model classes to auto-register |