module

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 14, 2026 License: MIT Imports: 3 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package module defines the Module interface — a compile-time unit that bundles related Commands, Component and Modal Routes, and Event listeners, with optional Setup and Teardown hooks. Modules are constructed by the bot author, who injects dependencies as struct fields; the framework provides no dependency container. Implemented in a later phase. See ADR 0003 and SPEC §2.6.

Package module defines the Module interface — a compile-time unit that bundles related Commands, Component and Modal Routes, and Event listeners, with optional Setup and Teardown lifecycle hooks. Modules are constructed by the bot author, who injects dependencies as struct fields; the framework provides no dependency container. See ADR 0003 and SPEC §2.6.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Module

type Module interface {
	// Register declares the module's commands, component routes, modal routes, and
	// autocomplete handlers on the router. Called once at bot startup before Setup.
	Register(r *router.Router)

	// Listeners returns the gateway event listeners this module wants subscribed.
	// May return nil or an empty slice if the module has no listeners.
	Listeners() []event.Listener

	// Setup is called after the gateway is open and all modules have been registered,
	// before the bot blocks. Modules should perform startup tasks (e.g. populate caches,
	// open connections) here. Setup is called in module registration order.
	// A non-nil error halts startup.
	Setup(ctx context.Context) error

	// Teardown is called when the bot is shutting down (ctx cancelled), in reverse
	// module registration order. Modules should release resources here.
	// All modules' Teardown is called even if an earlier Teardown returns an error.
	Teardown(ctx context.Context) error
}

Module is the extension point for grouping related commands, component/modal routes, and gateway event listeners. Each method is called by the Bot at the appropriate lifecycle point.

Modules are plain structs constructed by the bot author with dependencies as fields. The framework does not provide a dependency container. See ADR 0003 and SPEC §2.6.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL