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.
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.
| key | default | what it does |
|---|---|---|
instance | required | the module whose default export is your configured Seedcord |
entry | required | the file that starts the bot, and the one the build copies |
root | the config's own folder | the folder instance and entry resolve against |
tunnel | true | true 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 |
idleAnimation | true | whether the dev terminal animates while nothing happens |
build | {} | outDir (default dist), tsconfig, and bootstrap for seedcord build, resolved against the config's folder |
hmr | omitted | restart 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.
| command | what it does |
|---|---|
seedcord dev | runs your bot, reloads a changed file in place, and prints its logs in a terminal you can filter |
seedcord codegen | imports your bot and command files, then writes seedcord-gen.d.ts into root |
seedcord build | compiles src and writes a bootstrap file beside it |
seedcord commands | inspects 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 commandsYour 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.
| key | what it sets | where it's taught |
|---|---|---|
bot.interactions | the folder seedcord scans for handlers, plus middleware and ignored ids | Components |
bot.commands | the folder seedcord scans for commands | Commands |
bot.emojis | the emoji names Emojis resolves at startup | Components |
bot.events | the folder seedcord scans for event handlers. Gateway only | Events |
bot.clientOptions | passed straight to the discord.js Client. Gateway only | Your first bot |
subscribers | the folder seedcord scans for bus subscribers | The bus |
errors | how a fault renders, what gets logged, which api error codes get ignored | Tuning error behavior |
notifications | the contact name in the generic unknown-error message | Faults |
botColor | the accent on every BuilderComponent you build | Components |
ownerIds | the ids OwnerOnly treats as owners | Gates |
store | a durable store for framework state. The default keeps it in memory and loses it on restart | The rate limiter |
logger | the level, the sinks, and the per-channel overrides | Configuring the logger |
lifecycle | shutdownDeadline, how long shutdown may take | The 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 setsruntime: 'edge', so TypeScript rejectsportandlifecycleon it. - A gateway bot runs a small health server on port 6967 that answers
/health. ItshealthCheckkey takesfalseto turn that off, or an object withport,path, andhost. Emojisresolves 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.