Documentation
¶
Index ¶
- Variables
- func MessageValidatorIgnoreBot(session disgord.Session, message *disgord.Message) error
- func MessageValidatorIgnoreSelf(session disgord.Session, message *disgord.Message) error
- func MessageValidatorIgnoreWebhooks(session disgord.Session, message *disgord.Message) error
- type Builder
- type CMD
- type Command
- type CommandFunc
- type Context
- type ContextValidator
- type ContextValidatorFunc
- type ErrorHandler
- type ErrorHandlerFunc
- type Listener
- type ListenerFunc
- type Logger
- type MessageHandler
- type MessageValidator
- type MessageValidatorFunc
- type Options
- type PrefixGenerator
- type PrefixGeneratorFunc
- type Register
- type Router
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrorBotAuthorIgnored = errors.New("bot-author is ignored") ErrorSelfIgnored = errors.New("self-written-message are ignored") ErrorWebhooksIgnored = errors.New("webhook-messages are ignored") )
View Source
var ( ErrorPrefixGeneratorUndefined = errors.New("prefix-generator is required") ErrorNoCommandMatching = errors.New("no matching command found") )
Functions ¶
Types ¶
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
func NewBuilder ¶
func (*Builder) ErrorHandlers ¶
func (builder *Builder) ErrorHandlers(errorHandlers ...ErrorHandlerFunc) *Builder
func (*Builder) Then ¶
func (builder *Builder) Then(actions ...CommandFunc) Command
func (*Builder) Validators ¶
func (builder *Builder) Validators(validators ...ContextValidatorFunc) *Builder
type CMD ¶
type CMD struct {
Names []string
ErrorHandlers []ErrorHandlerFunc
Validators []ContextValidatorFunc
Actions []CommandFunc
}
func (*CMD) HandleError ¶
func (*CMD) ValidateContext ¶
type Command ¶
type Command interface {
ContextValidator
ErrorHandler
Primary() string
Labels() []string
SetLabels(labels ...string) Command
Self() interface{}
Run(ctx Context) error
}
type CommandFunc ¶
type ContextValidator ¶
type ContextValidatorFunc ¶
type ErrorHandler ¶
type ErrorHandlerFunc ¶
type ListenerFunc ¶
type Logger ¶
type Logger interface {
Error(args ...interface{})
Errorf(format string, args ...interface{})
Fatal(args ...interface{})
Fatalf(format string, args ...interface{})
Info(args ...interface{})
Infof(format string, args ...interface{})
Warn(args ...interface{})
Warnf(format string, args ...interface{})
Debug(args ...interface{})
Debugf(format string, args ...interface{})
}
type MessageHandler ¶
type MessageValidator ¶
type MessageValidatorFunc ¶
type Options ¶
type Options struct {
Logger Logger
PrefixGenerator PrefixGeneratorFunc
ErrorHandlers []ErrorHandlerFunc
MessageValidators []MessageValidatorFunc
Parser gommandparser.Parser
}
type PrefixGenerator ¶
type PrefixGeneratorFunc ¶
type Router ¶
type Router interface {
Register
Listener
ErrorHandler
MessageValidator
MessageHandler
PrefixGenerator
}
Click to show internal directories.
Click to hide internal directories.