command

package
Version: v1.18.0 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2019 License: Apache-2.0 Imports: 0 Imported by: 19

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

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL