Skip to content
Classhttpv0.10.2

Seedcord

The HTTP-interactions bot host, a long-running node server around the engine.

Discovers handlers from config.bot.interactions.path, verifies and dispatches interactions on start(), and runs coordinated shutdown with an in-flight drain. The edge deploy path calls createSeedcord from a generated entry.

class Seedcord<Cfg extends HttpConfig = HttpConfig>
    extends Pluggable<"http", RuntimeOfConfig<Cfg>>
    implements SeedcordInstance

Member visibility

Filter class members by access level.

constructor

Constructs a new instance of the Seedcord class

Seedcord(config: Cfg)

applicationId

The bot's Discord application id. Throws if you read it before the Configuration phase.

public get applicationId(): string

bus

public readonly bus: Bus

See also:Bus

port

The bound server port, populated once start() is listening.

public get port(): number | undefined

rest

Discord REST client built from bot.restOptions. start() sets the token.

public readonly rest: REST

username

The bot's discord username, populated by the ready fetch.

public get username(): string | undefined

attach()

Attaches a plugin under key. Read the instance back as core[key]. seedcord codegen writes the Core augmentation that types it there.

Put one dot in the key to nest the plugin under a group, so 'services.users' reads back as core.services.users. Each name holds one plugin or one group.

Startup runs each plugin's init() in attach order within its phase.

Attaching a plugin whose transport or runtime differs from this host fails to compile. Your constructor takes CoreBase as its first parameter (you don't need to pass it though). A narrower one fails to compile here.

attach<Key, Ctor>(
    this: this,
    key: AttachKeyAssert<Key, this>,
    Plugin: AttachableCtor<Ctor, BotT, BotRt>,
    args: PluginArgs<Ctor>
): this & Attached<Key, InstanceType<Ctor>>
Parameter: key

Also the channel the plugin logs on, dots included. Reserved channel names throw.

Parameter: args

Whatever your constructor takes after the host.

Throws:

A SeedcordError if you attach after the bot has started. A taken or reserved key throws too. So does a plugin that extends Plugin from another copy of @seedcord/core.

Inherited from:Pluggable

start()

Starts the host and runs the startup tasks.

public async start(): Promise<this>