Documentation ¶
Index ¶
- type Command
- type CommandOption
- type ErrorHandler
- type Group
- type GroupOption
- type Gumi
- func (g *Gumi) AddGroup(name string, opts ...GroupOption) *Group
- func (g *Gumi) GeneralGroup() *Group
- func (g *Gumi) Handle(s *discordgo.Session, m *discordgo.MessageCreate)
- func (g *Gumi) SetErrorHandler(eh ErrorHandler) *Gumi
- func (g *Gumi) SetHelpCommand(hc HelpHandler) *Gumi
- func (g *Gumi) SetPrefixHandler(ph PrefixResolver) *Gumi
- type GumiExec
- type HelpHandler
- type HelpSettings
- type Option
- type PrefixResolver
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Command ¶
type Command struct { Name string Aliases []string Description string GuildOnly bool NSFW bool Exec GumiExec Help *HelpSettings }
func NewCommand ¶
func NewCommand(name string, exec GumiExec, opts ...CommandOption) *Command
type CommandOption ¶
type CommandOption func(*Command)
func CommandDescription ¶
func CommandDescription(desc string) CommandOption
func GuildOnly ¶
func GuildOnly() CommandOption
func WithAliases ¶
func WithAliases(aliases ...string) CommandOption
func WithHelp ¶
func WithHelp(hs *HelpSettings) CommandOption
type ErrorHandler ¶
type ErrorHandler func(e error) *discordgo.MessageSend
ErrorHandler is a function that handles all errors caused by user commands, if nil uses default.
type Group ¶
type Group struct { Name string Description string NSFW bool Commands map[string]*Command IsVisible bool }
func (*Group) AddCommand ¶
func (g *Group) AddCommand(name string, exec GumiExec, opts ...CommandOption) *Command
type GroupOption ¶
type GroupOption func(*Group)
func GroupDescription ¶
func GroupDescription(desc string) GroupOption
func GroupNSFW ¶
func GroupNSFW() GroupOption
type Gumi ¶
type Gumi struct { Groups map[string]*Group //UngroupedCommands map[string]*GumiCommand DefaultPrefixes []string HelpCommand HelpHandler ErrorHandler ErrorHandler PrefixHandler PrefixResolver }
Gumi is a command framework for DiscordGo
func (*Gumi) AddGroup ¶
func (g *Gumi) AddGroup(name string, opts ...GroupOption) *Group
AddGroup creates a new group with given name and parameters. Please don't directly modify it, use functions instead.
func (*Gumi) GeneralGroup ¶
GeneralGroup returns a group autogenerated for help command and should be used for general-purpose commands. Although, you can modify it for your needs.
func (*Gumi) Handle ¶
func (g *Gumi) Handle(s *discordgo.Session, m *discordgo.MessageCreate)
Handle invokes a command handler for Gumi instance, should be called from within MessageCreate event in discordgo application.
func (*Gumi) SetErrorHandler ¶
func (g *Gumi) SetErrorHandler(eh ErrorHandler) *Gumi
SetErrorHandler sets an ErrorHandler for Gumi instance
func (*Gumi) SetHelpCommand ¶
func (g *Gumi) SetHelpCommand(hc HelpHandler) *Gumi
SetHelpCommand sets a HelpHandler for Gumi instance
func (*Gumi) SetPrefixHandler ¶
func (g *Gumi) SetPrefixHandler(ph PrefixResolver) *Gumi
SetPrefixHandler sets a PrefixHandler for GumiInstance
type HelpHandler ¶
type HelpHandler func(*Gumi, *discordgo.Session, *discordgo.MessageCreate, []string) *discordgo.MessageSend
HelpHandler ...
type HelpSettings ¶
type HelpSettings struct { IsVisible bool ExtendedHelp []*discordgo.MessageEmbedField }
HelpSettings are settings needed for default help command.
func NewHelpSettings ¶
func NewHelpSettings() *HelpSettings
func (*HelpSettings) AddField ¶
func (hs *HelpSettings) AddField(name, value string, inline bool) *HelpSettings
type Option ¶
type Option func(*Gumi)
Option is a type alias for optional functions
func WithErrorHandler ¶
func WithErrorHandler(eh ErrorHandler) Option
func WithHelpHandler ¶
func WithHelpHandler(hh HelpHandler) Option
func WithPrefixResolver ¶
func WithPrefixResolver(pr PrefixResolver) Option
func WithPrefixes ¶
type PrefixResolver ¶
PrefixResolver ...