commandregistry

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2026 License: MIT Imports: 5 Imported by: ? modules, 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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Definition

type Definition struct {
	Name        string
	Description string
	Args        string
	Section     commands.HelpSection

	RequiresPortal bool
	RequiresLogin  bool
	HasLogin       func(*commands.Event) bool
	Handler        func(*commands.Event)
}

Definition describes a chat command in a tool-like schema.

func (Definition) FullHandler

func (d Definition) FullHandler() *commands.FullHandler

FullHandler returns the maunium command handler for this definition.

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

Registry collects command handlers for registration.

func NewRegistry

func NewRegistry() *Registry

NewRegistry creates an empty registry.

func (*Registry) All

func (r *Registry) All() []*commands.FullHandler

All returns all handlers sorted by name.

func (*Registry) Get

func (r *Registry) Get(name string) *commands.FullHandler

Get retrieves a handler by canonical name.

func (*Registry) Names

func (r *Registry) Names() []string

Names returns all registered handler names.

func (*Registry) Register

func (r *Registry) Register(def Definition) *commands.FullHandler

Register adds a command definition to the registry and returns its handler.

func (*Registry) RegisterHandler

func (r *Registry) RegisterHandler(handler *commands.FullHandler)

RegisterHandler adds an already-constructed handler to the registry.

Jump to

Keyboard shortcuts

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