command

package
v0.0.0-...-f537024 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCommandNotFound      = errors.New("command not found")
	ErrCommandAlreadyExists = errors.New("command already exists")
	ErrCommandDoesNotExist  = errors.New("command does not exist")
)

Functions

This section is empty.

Types

type Cmd

type Cmd interface {
	Name() string
	Match(path []string) bool
	Execute(s *discordgo.Session, m *discordgo.MessageCreate, path []string) error
}

type Command

type Command struct {
	NameCmd    func() string
	MatchCmd   func(path []string) bool
	ExecuteCmd func(s *discordgo.Session, m *discordgo.MessageCreate, path []string) error
}

func (*Command) Execute

func (c *Command) Execute(s *discordgo.Session, m *discordgo.MessageCreate, path []string) error

func (*Command) Match

func (c *Command) Match(path []string) bool

func (*Command) Name

func (c *Command) Name() string

type CommandGroup

type CommandGroup struct {
	Commands       map[string]Cmd
	DefaultComnmnd Cmd
	MatchCmd       func(path []string) bool
	NameCmd        func() string
}

func (*CommandGroup) Execute

func (c *CommandGroup) Execute(s *discordgo.Session, m *discordgo.MessageCreate, path []string) error

func (*CommandGroup) Match

func (c *CommandGroup) Match(path []string) bool

func (*CommandGroup) Name

func (c *CommandGroup) Name() string

Jump to

Keyboard shortcuts

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