commands

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FALSY = []string{
	"false",
	"no",
	"0",
	"off",
}
View Source
var TRUTHY = []string{
	"true",
	"yes",
	"1",
	"on",
}

Functions

This section is empty.

Types

type Command

type Command struct {
	Name        string
	Aliases     []string
	ArgFormat   string
	Description string
	Callback    interface{}
}

func (*Command) Help

func (cmd *Command) Help() string

func (*Command) String

func (cmd *Command) String() string

type CommandGroup

type CommandGroup[User any] struct {
	// contains filtered or unexported fields
}

func NewCommandGroup

func NewCommandGroup[User any](namespace string, color game.TextColor) *CommandGroup[User]

func (*CommandGroup[User]) CanHandle

func (c *CommandGroup[User]) CanHandle(args []string) bool

Whether or not this command group can respond to this command.

func (*CommandGroup[User]) GetHelp

func (c *CommandGroup[User]) GetHelp(args []string) (string, error)

func (*CommandGroup[User]) Handle

func (c *CommandGroup[User]) Handle(ctx context.Context, user User, args []string) error

func (*CommandGroup[User]) Help

func (c *CommandGroup[User]) Help() string

func (*CommandGroup[User]) Name

func (c *CommandGroup[User]) Name() string

func (*CommandGroup[User]) Prefix

func (c *CommandGroup[User]) Prefix(message string) string

func (*CommandGroup[User]) Register

func (c *CommandGroup[User]) Register(commands ...Command) error

type Commandable

type Commandable interface {
	// Get help for a specific command (or empty string if it does not exist.)
	GetHelp([]string) (string, error)
	// Lists all commands.
	Help() string
}

Jump to

Keyboard shortcuts

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