slash

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: May 25, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command struct {
	Name        string         `json:"name"`
	Description string         `json:"description"`
	Usage       string         `json:"usage"`
	Aliases     []string       `json:"aliases"`
	Handler     CommandHandler `json:"-"`
	Flags       []Flag         `json:"flags"`
	Category    string         `json:"category"` // conversation, system, tools, info
}

Command represents a slash command

type CommandHandler

type CommandHandler func(ctx context.Context, args []string, flags map[string]interface{}) (string, error)

CommandHandler is the function signature for command handlers

type Flag

type Flag struct {
	Name        string      `json:"name"`
	Short       string      `json:"short"`
	Description string      `json:"description"`
	Type        string      `json:"type"` // string, int, bool
	Default     interface{} `json:"default"`
	Required    bool        `json:"required"`
}

Flag represents a command flag

type Manager

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

Manager handles slash commands

func NewManager

func NewManager() *Manager

NewManager creates a new slash command manager

func (*Manager) Autocomplete

func (m *Manager) Autocomplete(partial string) []string

Autocomplete returns completion suggestions

func (*Manager) Execute

func (m *Manager) Execute(ctx context.Context, input string) (string, error)

Execute executes a command

func (*Manager) Get

func (m *Manager) Get(name string) *Command

Get returns a command by name

func (*Manager) HelpText

func (m *Manager) HelpText(category string) string

HelpText generates help text for all commands

func (*Manager) List

func (m *Manager) List() []*Command

List returns all commands

func (*Manager) ListByCategory

func (m *Manager) ListByCategory(category string) []*Command

ListByCategory returns commands filtered by category

func (*Manager) ParseCommand

func (m *Manager) ParseCommand(input string) (*ParsedCommand, error)

ParseCommand parses a command string

func (*Manager) Register

func (m *Manager) Register(cmd *Command)

Register registers a new command

func (*Manager) Unregister

func (m *Manager) Unregister(name string)

Unregister removes a command

type ParsedCommand

type ParsedCommand struct {
	Name    string
	Args    []string
	Flags   map[string]interface{}
	Raw     string
	Handler *Command
}

ParsedCommand represents a parsed command

Jump to

Keyboard shortcuts

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