Skip to content

Package

core v0.11.0

Changelog

seedcordseedcord

The whole Discord bot, typed end to end

Website · Guide · Reference · Discord

npm node bun license

About

@seedcord/core is the code both seedcord transports share. It has the route decorators, the handler bases, checks, pagination, the startup and shutdown phases, and the plugin base. @seedcord/gateway and @seedcord/http connect it to Discord.

Both transports depend on core and re-export all of it, so a bot imports everything from its transport. Install core directly when you write a plugin that works on both transports.

seedcord is pre-1.0, so a minor version can break your plugin. Each release's changelog says what changed and how to update.

Installation

pnpm add -D @seedcord/core envapt typescript

Also list @seedcord/core in your plugin's peerDependencies, with the versions you tested against. A plugin that extends a different copy of core than the bot's throws CorePluginFromOtherCore when the bot attaches it.

Usage

A plugin extends Plugin from @seedcord/core/plugin and implements init():

import { Plugin } from '@seedcord/core/plugin';

export class Uptime extends Plugin {
    private startedAt = 0;

    public async init(): Promise<void> {
        this.startedAt = Date.now();
    }

    public elapsed(): number {
        return Date.now() - this.startedAt;
    }
}

A gateway or http bot attaches it with .attach('uptime', Uptime), and handlers call this.core.uptime.elapsed(). The Writing plugins guide covers options, lifecycle phases, testing a plugin locally, and publishing.