Documentation ¶
Overview ¶
Package commands provides a basic commands manager for a bot to use
View the example bot under github.com/foxbot/awg/bot to see its intended use.
Index ¶
Constants ¶
View Source
const (
// Prefix is the bot's prefix (TODO: dynamic)
Prefix = "~>>"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Commands ¶
type Commands struct {
// contains filtered or unexported fields
}
Commands is a structure to manage commands
func NewCommands ¶
func NewCommands(prefixFunc PrefixFunc) *Commands
NewCommands returns a Commands manager
type ErrorResult ¶
type ErrorResult struct {
Error error
}
ErrorResult is a result for a command that threw an error
func (ErrorResult) Act ¶
func (r ErrorResult) Act(ctx *Context) error
Act logs the error and writes a message to the channel
type PrefixFunc ¶
PrefixFunc defines the delegate to check a prefix
type TextResult ¶
type TextResult struct {
Message string
}
TextResult is a result for a command that writes text
func Textf ¶
func Textf(format string, args ...interface{}) TextResult
func (TextResult) Act ¶
func (r TextResult) Act(ctx *Context) error
Act writes a message to the channel
Click to show internal directories.
Click to hide internal directories.