Skip to content
GitHub

ShardingConfig

interface in meocord/interface Since 4.1.0

interface 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.

Examples

TypeScript
export default {
  discordToken: process.env.DISCORD_TOKEN!,
  sharding: { shards: 'auto', mode: 'process' },
} satisfies MeoCordConfig

Members

shards

shards?: number | 'auto'

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

Default: 'auto'

mode

mode?: 'internal' | 'process'

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

Default: 'internal'

development

development?: boolean

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

Default: false

See also

  • ShardContext
  • Sharding