Skip to content
GitHub

meocord.config.ts reference

MeoCord 4.1

Every option meocord.config.ts takes, with its type, its default and the version it first appeared in.

Every option meocord.config.ts takes, generated from the declarations of meocord 4.1.2. The file default-exports a MeoCordConfig.

appName

TypeDefaultSince
stringNone4.0.0

Shown as a prefix on every log line. Omitted when unset.

discordToken

TypeDefaultSince
stringRequired4.0.0

The Discord bot token. Read it from the environment rather than committing it.

bundleDependencies

TypeDefaultSince
booleanfalse4.0.0

Bundles everything the bot needs into dist, so it runs without node_modules.

Native addons such as sharp are copied with their platform binary into dist/node_modules. A build with native addons only starts on the platform it was built on.

externals

TypeDefaultSince
(string | RegExp)[]None4.0.0

Modules to keep out of the bundle. With bundleDependencies, listed package names are copied into dist/node_modules; native addons are found without being listed.

TypeScript
externals: ['@opentelemetry/api']

optionalExternals

TypeDefaultSince
string[]None4.1.0

Packages a dependency tries to load and runs without, such as supports-color, which debug probes for inside a try. Each stays a require where the dependency calls it, inside the dependency's own try, so a missing package is caught there rather than failing the bot at startup. With bundleDependencies, an installed one is copied into dist/node_modules.

Package names only. Do not also list a name in externals, which would turn it into an import that runs, and fails, before the bot's code.

TypeScript
optionalExternals: ['supports-color', '@node-rs/xxhash']

rsbuild

TypeDefaultSince
(config: RsbuildConfig) => RsbuildConfig | undefinedNone4.0.0

Customises the Rsbuild configuration the bot is built with.

Images, fonts, svg and media need no rules. Raw bundler rules go through tools.rspack.

sourceMappedStacks

TypeDefaultSince
booleantrue4.1.0

Makes stack traces name your source files, lines and columns, from the source map the build writes beside dist/main.js. Under Node, meocord start passes --enable-source-maps; under Bun, or Node started without the flag, the bundle maps each stack through Error.prepareStackTrace itself.

Set false for an error tracker that applies uploaded source maps to the bundle's positions, or a source mapper of your own.

shutdownTimeout

TypeDefaultSince
number10_0004.1.0

How long, in milliseconds, shutdown waits for the onShutdown hooks before destroying the client anyway: from 0 to 2147478647, the longest a timer keeps less the margin the shard manager waits on top. The limit covers the whole sequence, not each hook, including the calls under way that the cooldown store's shutdown waits for.

logLevel

TypeDefaultSince
'debug' | 'log' | 'warn' | 'error' | 'silent''debug' while NODE_ENV is development, as under meocord start --dev, and 'log' otherwise4.1.0

The least severe log line Logger prints: 'debug' prints everything, 'log' hides [DEBUG], 'warn' prints warnings and errors, 'error' only errors, and 'silent' nothing. The MEOCORD_LOG_LEVEL environment variable overrides it for one run, without a rebuild.

TypeScript
logLevel: 'warn',

commands

TypeDefaultSince
CommandRegistrationConfigEvery command registered globally, each time the bot starts.4.1.0

Where the bot registers its application commands, and whether it does so at startup.

commands is a CommandRegistrationConfig.

Where and whether MeoCord registers the application's commands with Discord, set as meocord.config.ts's commands.

Global commands can take a while to show up in clients; guild commands appear at once, which is what a development guild is for. Set register: false to register only with meocord register, from CI for instance.

commands.guilds

TypeDefaultSince
(string | undefined)[]None4.1.0

Guilds to register every command to instead of globally. Unset or empty registers globally. Blank ids are dropped; a list with none left, as [process.env.GUILD_ID] leaves it with the variable unset, registers those commands nowhere, with a warning, rather than globally. A builder's own guilds option takes precedence for its command.

commands.developmentGuild

TypeDefaultSince
stringNone4.1.0

A guild that receives every command, and nothing else does, while NODE_ENV is development — as under meocord start --dev. Ignored in production.

commands.register

TypeDefaultSince
booleantrue4.1.0

Whether the bot registers its commands when it starts. Set false to register only with meocord register, from CI for instance.

commands.clearOther

TypeDefaultSince
booleanfalse4.1.0

Whether to remove this application's commands from the scopes this configuration names but is not registering to, such as the global commands left behind after moving to guilds. Without it, such leftovers are reported as a warning. While developmentGuild receives every command, as under start --dev, leftovers are only warned about, since a production bot sharing the application may own them; production starts and meocord register without --dev remove them.

sharding

TypeDefaultSince
ShardingConfigOne connection, or whatever clientOptions.shards says.4.1.0

Splits the bot's gateway connection into shards, which Discord requires from about 2,500 servers.

sharding is a ShardingConfig.

How the bot splits its gateway connection into shards, set as meocord.config.ts's sharding.

Discord requires sharding from about 2,500 servers. Keep the default mode, every shard in one process, until the bot needs more than one CPU core.

sharding.shards

TypeDefaultSince
number | 'auto''auto'4.1.0

How many shards to run: a number, or 'auto' for the count Discord recommends.

sharding.mode

TypeDefaultSince
'internal' | 'process''internal'4.1.0

'internal' runs every shard in one process; 'process' runs each shard in a process of its own.

sharding.development

TypeDefaultSince
booleanfalse4.1.0

Whether mode: 'process' also applies under meocord start --dev. Off by default, so the development watcher restarts one process and never leaves shards behind.