MeoCordConfig
interface in meocord/interface Since 4.0.0
interface MeoCordConfigThe configuration meocord.config.ts exports: the bot's token, how it is built, and how it registers and shards.
It holds what the CLI and the process need before the app class is read. What the app itself does, its
controllers, intents and message options, belongs in @MeoCord instead. A new app's config file loads its .env
files with dotenv first, so process.env holds their values.
Examples
export default {
appName: 'My Bot',
// Read from .env, since this file is committed
discordToken: process.env.DISCORD_TOKEN!,
commands: { developmentGuild: process.env.DEV_GUILD_ID || undefined },
} satisfies MeoCordConfigMembers
appName
appName?: stringShown as a prefix on every log line. Omitted when unset.
discordToken
discordToken: stringThe Discord bot token. Read it from the environment rather than committing it.
bundleDependencies
bundleDependencies?: booleanBundles 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.
Default: false
externals
externals?: (string | RegExp)[]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 Since 4.1.0
optionalExternals?: string[]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
rsbuild?: (config: RsbuildConfig) => RsbuildConfig | undefinedCustomises the Rsbuild configuration the bot is built with.
Images, fonts, svg and media need no rules. Raw bundler rules go through tools.rspack.
sourceMappedStacks Since 4.1.0
sourceMappedStacks?: booleanMakes 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.
Default: true
shutdownTimeout Since 4.1.0
shutdownTimeout?: numberHow 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.
Default: 10_000
logLevel Since 4.1.0
logLevel?: 'debug' | 'log' | 'warn' | 'error' | 'silent'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.
Default: 'debug'` while `NODE_ENV` is `development`, as under `meocord start --dev`, and
`'log'` otherwise
logLevel: 'warn',commands Since 4.1.0
commands?: CommandRegistrationConfigWhere the bot registers its application commands, and whether it does so at startup.
Default: Every command registered globally, each time the bot starts.
sharding Since 4.1.0
sharding?: ShardingConfigSplits the bot's gateway connection into shards, which Discord requires from about 2,500 servers.
Default: One connection, or whatever `clientOptions.shards` says.
See also
- MeoCord
- Configuration