botcmd

package
v2.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2026 License: GPL-3.0 Imports: 4 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

Overview

Package botcmd parses commands and provides alias-aware command middleware.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command struct {
	Name     string
	Args     []string
	Raw      string
	HasSlash bool
}

Command contains a normalized command name and arguments.

func ParseEvent

func ParseEvent(ev event.Event) Command

ParseEvent parses command information from an engine event.

func ParseText

func ParseText(text string) Command

ParseText parses a slash-prefixed command string.

type Container

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

Container registers command handlers and exposes them as middleware.

func NewContainer

func NewContainer() *Container

func (*Container) Alias

func (c *Container) Alias(alias, command string)

func (*Container) Command

func (c *Container) Command(name string, h Handler)

func (*Container) Middleware

func (c *Container) Middleware() middleware.Middleware

type Handler

type Handler func(*botctx.Context, Command) error

type Registry

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

Registry resolves command aliases.

func NewRegistry

func NewRegistry() *Registry

func (*Registry) Alias

func (r *Registry) Alias(alias, command string)

func (*Registry) Resolve

func (r *Registry) Resolve(name string) string

Jump to

Keyboard shortcuts

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