Skip to content

Tooling

Configure a seedcord project through its two config files, one for the CLI and one for your bot. Covers every key in seedcord.config.ts, the commands that read it, and where each key of your bot's own config gets taught.

A seedcord project has two config files, because two different programs read them. seedcord dev and seedcord codegen have to import your bot before it runs, so they need its path from somewhere other than the bot itself. seedcord.config.ts holds those paths for the CLI. The new Seedcord({ ... }) call in src/bot.ts configures the bot while it runs.

The CLI looks for seedcord.config.ts or seedcord.config.mts in the directory you run it from.

seedcord.config.ts
import { defineConfig } from 'seedcord';

export default defineConfig({
    root: './src',
    instance: './bot.ts',
    entry: './index.ts',
    // false stops the dev terminal's idle animation
    idleAnimation: true,
    build: {
        tsconfig: './tsconfig.build.json'
    },
    hmr: {
        // true runs tsc --watch beside the bot, in a second node process
        typecheck: false
    }
});

You have to write instance and entry. Every other key has a default.

keydefaultwhat it does
instancerequiredthe module whose default export is your configured Seedcord
entryrequiredthe file that starts the bot, and the one the build copies
rootthe config's own folderthe folder instance and entry resolve against
tunneltruetrue opens a cloudflared quick tunnel to your http bot, and false turns it off. An https string is a URL you already serve. A gateway bot ignores it
idleAnimationtruewhether the dev terminal animates while nothing happens
build{}outDir (default dist), tsconfig, and bootstrap for seedcord build, resolved against the config's folder
hmromittedrestart globs, rollback, and typecheck for seedcord dev

entry has to resolve inside root. A path outside it throws CliConfigEntryOutsideRoot.

The commands

A project from create-seedcord has dev, codegen, and build as scripts in its package.json, and all three read the config above.

commandwhat it does
seedcord devruns your bot, reloads a changed file in place, and prints its logs in a terminal you can filter
seedcord codegenimports your bot and command files, then writes seedcord-gen.d.ts into root
seedcord buildcompiles src and writes a bootstrap file beside it
seedcord commandsinspects and cleans up the commands Discord has registered for your bot

seedcord commands doesn't read the config. It reads DISCORD_BOT_TOKEN from your environment. It isn't one of the scripts either, so run it through your package manager's runner.

pnpm exec seedcord commands

Your bot's config

src/bot.ts holds the second config, the one your bot reads. Every key gets taught on the page that needs it, inside a real new Seedcord({ ... }) sample. The last column names that page.

bot, subscribers, bot.interactions, and bot.commands are required. A gateway bot also has to set bot.events and bot.clientOptions. Every other key is optional.

keywhat it setswhere it's taught
bot.interactionsthe folder seedcord scans for handlers, plus middleware and ignored idsComponents
bot.commandsthe folder seedcord scans for commandsCommands
bot.emojisthe emoji names Emojis resolves at startupComponents
bot.eventsthe folder seedcord scans for event handlers. Gateway onlyEvents
bot.clientOptionspassed straight to the discord.js Client. Gateway onlyYour first bot
subscribersthe folder seedcord scans for bus subscribersThe bus
errorshow a fault renders, what gets logged, which api error codes get ignoredTuning error behavior
notificationsthe contact name in the generic unknown-error messageFaults
botColorthe accent on every BuilderComponent you buildComponents
ownerIdsthe ids OwnerOnly treats as ownersGates
storea durable store for framework state. The default keeps it in memory and loses it on restartThe rate limiter
loggerthe level, the sinks, and the per-channel overridesConfiguring the logger
lifecycleshutdownDeadline, how long shutdown may takeThe lifecycle
runtime'server' for a node process, 'edge' for a bundled isolate like a Cloudflare Worker. A gateway bot only accepts 'server'Building

Gateway and http differ

Each transport package declares its own Seedcord and its own config type, and a few keys only exist on one of them.

  • An http server takes port, which defaults to 3000. An edge bot sets runtime: 'edge', so TypeScript rejects port and lifecycle on it.
  • A gateway bot runs a small health server on port 6967 that answers /health. Its healthCheck key takes false to turn that off, or an object with port, path, and host.
  • Emojis resolves each name to a discord.js emoji on gateway, and to a plain resolved emoji object on http.

The reference site has the full type of every one of these, down to each nested field.

Next, the dev terminal runs your bot while you edit it. An http bot also needs a tunnel before Discord can reach it on your machine.