Documentation ¶
Index ¶
- Variables
- type ArgType
- type Argument
- type ArgumentError
- type Command
- type CommandContext
- func (ctx *CommandContext) Author() *disgord.User
- func (ctx *CommandContext) AuthorMember() *disgord.Member
- func (ctx *CommandContext) Guild() (*disgord.Guild, error)
- func (ctx *CommandContext) IsAuthorOwner() bool
- func (ctx *CommandContext) IsPrivate() bool
- func (ctx *CommandContext) Reply(data ...interface{}) (*disgord.Message, error)
- type ConsoleLogger
- type Gourd
- type Handler
- type KeywordInhibitor
- type Listener
- type ListenerHandler
- type Logger
- type Middleware
- type MiddlewareHandler
- type Module
- func (module *Module) AddCommand(cmd *Command) *Module
- func (module *Module) AddCommands(cmds ...*Command) *Module
- func (module *Module) AddListener(l *ListenerHandler) *Module
- func (module *Module) AddListeners(l ...*ListenerHandler) *Module
- func (module *Module) NewCommand(aliases ...string) *Command
- type NilInhibitor
- type OwnerInhibitor
- type PermissionInhibitor
- type RoleInhibitor
Constants ¶
This section is empty.
Variables ¶
var Console = ConsoleLogger{}
Functions ¶
This section is empty.
Types ¶
type ArgumentError ¶
type ArgumentError struct {
Arguments []Argument
}
func (*ArgumentError) Error ¶
func (argError *ArgumentError) Error() string
type CommandContext ¶
type CommandContext struct { Prefix string Args []string CommandString string Message *disgord.Message Client *disgord.Client Gourd *Gourd Command *Command }
func (*CommandContext) Author ¶
func (ctx *CommandContext) Author() *disgord.User
func (*CommandContext) AuthorMember ¶
func (ctx *CommandContext) AuthorMember() *disgord.Member
func (*CommandContext) IsAuthorOwner ¶
func (ctx *CommandContext) IsAuthorOwner() bool
func (*CommandContext) IsPrivate ¶
func (ctx *CommandContext) IsPrivate() bool
func (*CommandContext) Reply ¶
func (ctx *CommandContext) Reply(data ...interface{}) (*disgord.Message, error)
Reply sends a message to the channel the command was used in. Input is any type, see https://github.com/andersfylling/disgord/blob/39ba986ca2e94602ce44f4bf7625063124bdc325/client.go#L705
type ConsoleLogger ¶
type ConsoleLogger struct{}
func (ConsoleLogger) Debug ¶
func (ConsoleLogger) Debug(m ...interface{})
func (ConsoleLogger) Err ¶
func (ConsoleLogger) Err(m ...interface{})
func (ConsoleLogger) Info ¶
func (ConsoleLogger) Info(m ...interface{})
type Gourd ¶
type Gourd struct {
// contains filtered or unexported fields
}
func (*Gourd) AddKeyword ¶
AddKeyword adds a keyword permission to the given user. This keyword is stored in runtime memory and used in the KeywordInhibitor
func (*Gourd) AddModules ¶
type Handler ¶
type Handler struct { Commands []*Command Listeners []*ListenerHandler Modules []*Module }
func (*Handler) GetCommandMap ¶
func (*Handler) GetModuleMap ¶
type KeywordInhibitor ¶
type KeywordInhibitor struct { Value string Response interface{} }
KeywordInhibitor allows command usage if the user has the given keyword. Value is the string keyword they should be assigned to. See <wiki link here> for keyword how-tos
type Listener ¶
type Listener struct { Type string Middlewares []MiddlewareHandler OnEvent func(session disgord.Session, event struct{}) }
Listener is the Gourd implementation of event handlers. Type is a required field, and it is suggested to use disgord supplied events (ex: disgord.EvtMessageCreate). OnEvent is the handler function, and takes an interface that should be cast appropriately (ex: event.(*disgord.MessageCreate) ).
type ListenerHandler ¶
type Logger ¶
type Logger interface { Debug(m ...interface{}) Info(m ...interface{}) Err(m ...interface{}) }
type Middleware ¶
type Middleware struct{}
Middleware is the Gourd representation of Disgord Middlewares
type MiddlewareHandler ¶
type MiddlewareHandler interface {
// contains filtered or unexported methods
}
type Module ¶
type Module struct { Name string Description string Commands []*Command Listeners []*ListenerHandler }
func (*Module) AddCommand ¶
func (*Module) AddCommands ¶
func (*Module) AddListener ¶
func (module *Module) AddListener(l *ListenerHandler) *Module
func (*Module) AddListeners ¶
func (module *Module) AddListeners(l ...*ListenerHandler) *Module
func (*Module) NewCommand ¶
type NilInhibitor ¶
type NilInhibitor struct{}
NilInhibitor allows command usage no matter what. Does not have a value or a response
type OwnerInhibitor ¶
type OwnerInhibitor struct {
Response interface{}
}
OwnerInhibitor allows command usage only if the user is the bot owner. Does not have a value; the owner ID is supplied in Gourd initialization.
type PermissionInhibitor ¶
type PermissionInhibitor struct { Value uint64 Response interface{} }
PermissionInhibitor allows command usage if the user has the permission bit (value). Value is the disgord.PermissionBit. It is recommended to use disgord.PermissionBlahBlah. This inhibitor will not work in private messages as there are no permissions.
type RoleInhibitor ¶
type RoleInhibitor struct { Value string Response interface{} }
RoleInhibitor allows command usage if the user has the role (value). Value is the string ID of the role, **NOT the snowflake!**. This inhibitor will not work in private messages as there are no roles.