Skip to content

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.

seedcord.config.ts
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

commandwhat it does
seedcord devruns 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 codegenimports your bot and command files, then writes seedcord-gen.d.ts into root
seedcord buildtype checks your bot and bundles it for a server, a Cloudflare Worker, or another program to import
seedcord commandsdeploys 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.

keywhat it setswhere it's taught
bot.interactionsthe folder seedcord scans for handlers, plus middleware and ignored idsComponents
bot.commandsthe folder seedcord scans for commands, and guilds, the test servers that bare @RegisterCommand() commands deploy toCommands, Test servers
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

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 takes port, which defaults to 3000, and port: false lets your own server host the bot. TypeScript rejects port, lifecycle, and healthCheck on an edge bot.
  • healthCheck takes different options on gateway and on a node http server. The health server covers both.
  • Emojis on gateway holds a subclass of ResolvedEmoji tied to the discord.js GuildEmoji or ApplicationEmoji. Emojis on http holds a plain ResolvedEmoji.

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.