command

package
v2.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2020 License: Apache-2.0 Imports: 0 Imported by: 20

Documentation

Overview

Package command is an interface for defining bot commands

Index

Constants

This section is empty.

Variables

View Source
var (
	// Commmands keyed by golang/regexp patterns
	// regexp.Match(key, input) is used to match
	Commands = map[string]Command{}
)

Functions

This section is empty.

Types

type Command

type Command interface {
	// Executes the command with args passed in
	Exec(args ...string) ([]byte, error)
	// Usage of the command
	Usage() string
	// Description of the command
	Description() string
	// Name of the command
	String() string
}

Command is the interface for specific named commands executed via plugins or the bot.

func NewCommand

func NewCommand(name, usage, description string, exec func(args ...string) ([]byte, error)) Command

NewCommand helps quickly create a new command

Jump to

Keyboard shortcuts

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