Tooling
Point the seedcord CLI at your bot with seedcord.config.ts, and pick the command that runs, builds, or deploys it.
A seedcord project has two config files, because two different programs read them. seedcord dev, codegen, build, and commands deploy have to import your bot before it runs, so they need its path from somewhere other than the bot itself. seedcord.config.ts holds that path for the CLI. The new Seedcord({ ... }) call in src/bot.ts builds a Seedcord bot and configures it 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',
build: { start: './index.ts' }
});Only instance is required. build.start is optional. Without it, the build's index.mjs default-exports the bot for your own node server to start. An edge bot, which runs on Cloudflare Workers, leaves it out too. Your first bot explains how root, instance, and build.start fit together.
Every other key is optional: root, files, vitePlugins, tunnel, hmr, idleAnimation, the rest of build, and port on an edge bot. The config reference lists each one with its default. vitePlugins takes a function that returns Vite plugins, like () => [yaml()].
The commands
| 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. An edge bot runs in workerd |
seedcord codegen | imports your bot and command files, then writes seedcord-gen.d.ts into root |
seedcord build | type checks your bot and bundles it for a server, a Cloudflare Worker, or another program to import |
seedcord commands | deploys your commands to Discord, lists what Discord holds, and deletes the ones you no longer want |
A project from create-seedcord wraps these as scripts, along with check, commands:deploy, and the deploy and types scripts of an edge bot. Your first bot lists every one.
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 links to 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, and guilds, the test servers that bare @RegisterCommand() commands deploy to | Commands, Test servers |
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 |
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.
- Both http configs take
bot.restOptions. Only a node http server takesport, which defaults to 3000, andport: falselets your own server host the bot. TypeScript rejectsport,lifecycle, andhealthCheckon an edge bot. healthChecktakes different options on gateway and on a node http server. The health server covers both.Emojison gateway holds a subclass ofResolvedEmojitied to the discord.jsGuildEmojiorApplicationEmoji.Emojison http holds a plainResolvedEmoji.
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.