meocord.config.ts reference
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.2.0. The file default-exports a MeoCordConfig.
appName
| Type | Default | Since |
|---|---|---|
string | None | 4.0.0 |
Shown as a prefix on every log line. Omitted when unset.
discordToken
| Type | Default | Since |
|---|---|---|
string | Required | 4.0.0 |
The Discord bot token. Read it from the environment rather than committing it.
bundleDependencies
| Type | Default | Since |
|---|---|---|
boolean | false | 4.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
| Type | Default | Since |
|---|---|---|
(string | RegExp)[] | None | 4.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.
externals: ['@opentelemetry/api']optionalExternals
| Type | Default | Since |
|---|---|---|
string[] | None | 4.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.
optionalExternals: ['supports-color', '@node-rs/xxhash']rsbuild
| Type | Default | Since |
|---|---|---|
(config: RsbuildConfig) => RsbuildConfig | undefined | None | 4.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
| Type | Default | Since |
|---|---|---|
boolean | true | 4.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.
startupErrors
| Type | Default | Since |
|---|---|---|
'first' | 'all' | 'first'; 'all' in the next major version (5.0) | 4.2.0 |
How a startup error a decorator finds, such as an invalid customId pattern, is reported.
With 'first', a decorator throws its error as its class is defined, when its file is imported, so a bot with
three mistakes shows one per run. With 'all', decorators keep their errors, and MeoCordFactory.create() logs
every one, each with its handler and file, alongside the errors its own checks find, then throws the first. The
built bot reads it before your modules load. In a test, call reportAllStartupErrors() from meocord/testing in
the setup file instead.
Whichever you choose, create() reports every error its own checks find, such as two handlers of one command.
shutdownTimeout
| Type | Default | Since |
|---|---|---|
number | 10_000 | 4.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
| Type | Default | Since |
|---|---|---|
'debug' | 'log' | 'warn' | 'error' | 'silent' | 'debug' while NODE_ENV is development, as under meocord start --dev, and 'log' otherwise | 4.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.
logLevel: 'warn',commands
| Type | Default | Since |
|---|---|---|
CommandRegistrationConfig | Every 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
| Type | Default | Since |
|---|---|---|
(string | undefined)[] | None | 4.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
| Type | Default | Since |
|---|---|---|
string | None | 4.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
| Type | Default | Since |
|---|---|---|
boolean | true | 4.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
| Type | Default | Since |
|---|---|---|
boolean | false | 4.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
| Type | Default | Since |
|---|---|---|
ShardingConfig | One 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
| Type | Default | Since |
|---|---|---|
number | 'auto' | 'auto' | 4.1.0 |
How many shards to run: a number, or 'auto' for the count Discord recommends.
sharding.mode
| Type | Default | Since |
|---|---|---|
'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
| Type | Default | Since |
|---|---|---|
boolean | false | 4.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.