Package
seedcord v0.24.0

About
seedcord is the CLI a bot project runs during development and at build time. It reads seedcord.config.ts and gives you a dev server with hot reload, a production build, and the codegen that types your commands. It also deploys those commands to Discord, uploads your emojis from a folder of images, and writes new files from your own templates.
It loads your bot through Vite every time, with any Vite plugin you add. Those plugins, your .env modes, and bundled data files you set up in dev work the same way in the build. One seedcord build makes a Node or Bun server, a single Bun binary, a Cloudflare Worker, or a package another app installs and starts.
seedcord is in beta, so a minor version can break your bot. Each release's changelog says what changed and how to update.
Installation
pnpm create seedcord adds it to a new project. To add it to an existing one:
pnpm add -D seedcord viteRun it through your project's scripts, like pnpm dev. A global seedcord throws CliNotProjectInstall because the CLI has to load the same seedcord packages your bot imports.
Commands
| command | what it does |
|---|---|
seedcord dev |
runs the bot from the config file, reloading changed modules in place |
seedcord build |
type checks the bot and bundles it into outDir with Vite. An edge bot builds into a Cloudflare worker |
seedcord codegen |
writes the typed augmentations for your commands and config |
seedcord commands |
deploys, lists and cleans up your commands on Discord |
seedcord emojis |
uploads the images in your emojis folder to your application, and lists, downloads or deletes its emojis |
seedcord make |
writes new files from one of your Handlebars templates, or one an installed plugin ships |
seedcord ask |
searches the guide for a question, a pasted error, or an error code, and works outside a project |
codegen --check verifies the committed augmentations match your source. Run it in CI.
make asks for a name and each value that the template reads. The make guide shows how to write a template.
commands reads DISCORD_BOT_TOKEN from your environment or .env:
seedcord commands # pick what to do from a menu
seedcord commands deploy # show what changes, then ask before deploying
seedcord commands deploy --yes # deploy without asking
seedcord commands deploy --force # also deploy scopes that match the last deploy
seedcord commands list # show the commands Discord has
seedcord commands list --all-guilds # include every guild the bot is in
seedcord commands list --json # print them as JSON
seedcord commands clean # pick guilds, then delete commands that duplicate a global one
seedcord commands clean --all-guilds # list those duplicates in every guild
seedcord commands clean --all-guilds --yes # delete them
seedcord commands purge # pick where, then delete every command there
seedcord commands purge --guilds 111 222 # list every command in those guilds
seedcord commands purge --global --yes # delete every global commandemojis works on the images in ./emojis, beside your config. wave.png uploads as the emoji wave, and your code reads it as Emojis.Wave:
seedcord emojis # pick what to do from a menu
seedcord emojis push # show what's missing on Discord, then ask before uploading
seedcord emojis push --replace wave # upload wave again after you changed its image
seedcord emojis list # compare the folder with Discord
seedcord emojis list --check # fail when a file isn't uploaded, for CI
seedcord emojis pull # download the emojis your folder doesn't have
seedcord emojis pull --guild # pick a guild and download its emojis
seedcord emojis remove wave # delete wave from Discord, and ask about its fileIn CI, or anywhere without a terminal, nothing changes on Discord unless you pass --yes.
On the http transport, dev also opens a cloudflared tunnel and points Discord's interactions URL at it.
Pass --verbose to any command for the resolved config and full error stacks.
Config
defineConfig types seedcord.config.ts:
import yaml from '@rollup/plugin-yaml';
import { defineConfig } from 'seedcord';
export default defineConfig({
root: './src',
instance: './bot.ts',
build: { start: './index.ts' },
files: ['./locales'],
vitePlugins: () => [yaml()]
});instanceis the file that exports your bot.build.startis the file that starts it. Leave it out to build the bot as a package.fileslists the folders of data files the build bundles. The bot reads them withreadFiles.vitePluginstakes any Vite plugin, and each one runs in dev and in the build. With the YAML plugin above, a handler can import a.yamlfile.
ENV=staging pnpm build builds in staging mode and loads your .env.staging files. envapt reads the same mode in your bot.
The config guide covers every key.
Edge bots
A cloudflare.config.ts beside seedcord.config.ts turns an http bot into a Cloudflare Worker. seedcord dev runs it in workerd, and seedcord build writes a worker you deploy with cf deploy --prebuilt. The Workers guide covers the setup.