Documentation
¶
Index ¶
- Variables
- type Command
- type CommandFunc
- type CommandHandler
- func (c *CommandHandler) AddCommand(name, desc string, aliases []string, owneronly, hidden bool, ...) error
- func (c *CommandHandler) AddOwner(id string)
- func (c *CommandHandler) AddPrefix(prefix string)
- func (c *CommandHandler) ClearDebugFunc()
- func (c *CommandHandler) ClearHelpCommand()
- func (c *CommandHandler) ClearOnErrorFunc()
- func (c *CommandHandler) ClearPrerunFunc()
- func (c *CommandHandler) GetAllPrefixes() []string
- func (c *CommandHandler) GetCheckPermissions(enable bool) bool
- func (c *CommandHandler) GetDebugFunc() DebugFunc
- func (c *CommandHandler) GetEnable() bool
- func (c *CommandHandler) GetHelpCommand() *HelpCommand
- func (c *CommandHandler) GetIgnoreBots() bool
- func (c *CommandHandler) GetOnErrorFunc() OnErrorFunc
- func (c *CommandHandler) GetOwners() []string
- func (c *CommandHandler) GetPrerunFunc() PrerunFunc
- func (c *CommandHandler) GetUseState() bool
- func (c *CommandHandler) IsOwner(id string) bool
- func (c *CommandHandler) MessageHandler(s *discordgo.Session, event *discordgo.MessageCreate)
- func (c *CommandHandler) RemoveCommand(name string) error
- func (c *CommandHandler) RemoveOwner(id string)
- func (c *CommandHandler) RemovePrefix(prefix string)
- func (c *CommandHandler) SetAllPrefixes(prefixes []string)
- func (c *CommandHandler) SetCheckPermissions(enable bool)
- func (c *CommandHandler) SetDebugFunc(df DebugFunc)
- func (c *CommandHandler) SetEnable(enable bool)
- func (c *CommandHandler) SetHelpCommand(name string, aliases []string, selfperms, userperms int, ...) error
- func (c *CommandHandler) SetIgnoreBots(enable bool)
- func (c *CommandHandler) SetOnErrorFunc(oef OnErrorFunc)
- func (c *CommandHandler) SetOwners(ids []string)
- func (c *CommandHandler) SetPrerunFunc(prf PrerunFunc)
- func (c *CommandHandler) SetUseState(enable bool)
- type CommandType
- type Context
- func (c *Context) Reply(message string) (*discordgo.Message, error)
- func (c *Context) ReplyComplex(message string, tts bool, embed *discordgo.MessageEmbed, ...) (*discordgo.Message, error)
- func (c *Context) ReplyDiscordgoEmbed(embed *discordgo.MessageEmbed) (*discordgo.Message, error)
- func (c *Context) ReplyEmbed(embed embedutil.Embed) (*discordgo.Message, error)
- func (c *Context) ReplyFile(filename string, file io.Reader) (*discordgo.Message, error)
- type DebugFunc
- type HelpCommand
- type HelpCommandFunc
- type OnErrorFunc
- type PrerunFunc
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrBotBlocked = errors.New("bots are ignored") // If bots are ignored return to error ErrCommandAlreadyRegistered = errors.New("another command was already registered by this name") // If another command is already registered by this name return to error ErrCommandNotFound = errors.New("command not found") // If command is not found return to error ErrDMOnly = errors.New("dm-only command on guild") // ErrDMOnly : If DM only command is used on guild return to error ErrGuildOnly = errors.New("guild-only command on dm") // ErrGuildOnly : If Guild only command is used on DM return to error ErrOwnerOnly = errors.New("owner-only command") // ErrOwnerOnly : If someone is trying to run owner only command return to error ErrSelfInsufficientPermissions = errors.New("missing permission(s) for bot") // ErrSelfInsufficientPermissions : If bot doesn't have enough permission return to error ErrUserInsufficientPermissions = errors.New("missing permission(s) for user") // ErrUserInsufficientPermissions : If user doesn't have enough permission return to error )
Functions ¶
This section is empty.
Types ¶
type Command ¶
type Command struct { Aliases []string Description string Name string Hidden bool OwnerOnly bool SelfPermissions int UserPermissions int Run CommandFunc Type CommandType }
Command structure
type CommandFunc ¶
CommandFunc is function to run all commands
type CommandHandler ¶
type CommandHandler struct {
// contains filtered or unexported fields
}
CommandHandler structure
func New ¶
func New(prefixes []string, owners []string, useState, ignoreBots, checkPermssions bool) CommandHandler
New returns a new CommandHandler
func (*CommandHandler) AddCommand ¶
func (c *CommandHandler) AddCommand(name, desc string, aliases []string, owneronly, hidden bool, selfperms, userperms int, cmdtype CommandType, run CommandFunc) error
func (*CommandHandler) AddOwner ¶
func (c *CommandHandler) AddOwner(id string)
func (*CommandHandler) AddPrefix ¶
func (c *CommandHandler) AddPrefix(prefix string)
func (*CommandHandler) ClearDebugFunc ¶
func (c *CommandHandler) ClearDebugFunc()
func (*CommandHandler) ClearHelpCommand ¶
func (c *CommandHandler) ClearHelpCommand()
func (*CommandHandler) ClearOnErrorFunc ¶
func (c *CommandHandler) ClearOnErrorFunc()
func (*CommandHandler) ClearPrerunFunc ¶
func (c *CommandHandler) ClearPrerunFunc()
func (*CommandHandler) GetAllPrefixes ¶
func (c *CommandHandler) GetAllPrefixes() []string
func (*CommandHandler) GetCheckPermissions ¶
func (c *CommandHandler) GetCheckPermissions(enable bool) bool
func (*CommandHandler) GetDebugFunc ¶
func (c *CommandHandler) GetDebugFunc() DebugFunc
func (*CommandHandler) GetEnable ¶
func (c *CommandHandler) GetEnable() bool
func (*CommandHandler) GetHelpCommand ¶
func (c *CommandHandler) GetHelpCommand() *HelpCommand
func (*CommandHandler) GetIgnoreBots ¶
func (c *CommandHandler) GetIgnoreBots() bool
func (*CommandHandler) GetOnErrorFunc ¶
func (c *CommandHandler) GetOnErrorFunc() OnErrorFunc
func (*CommandHandler) GetOwners ¶
func (c *CommandHandler) GetOwners() []string
func (*CommandHandler) GetPrerunFunc ¶
func (c *CommandHandler) GetPrerunFunc() PrerunFunc
func (*CommandHandler) GetUseState ¶
func (c *CommandHandler) GetUseState() bool
func (*CommandHandler) IsOwner ¶
func (c *CommandHandler) IsOwner(id string) bool
func (*CommandHandler) MessageHandler ¶
func (c *CommandHandler) MessageHandler(s *discordgo.Session, event *discordgo.MessageCreate)
Message handler function for Command Handler.
func (*CommandHandler) RemoveCommand ¶
func (c *CommandHandler) RemoveCommand(name string) error
func (*CommandHandler) RemoveOwner ¶
func (c *CommandHandler) RemoveOwner(id string)
func (*CommandHandler) RemovePrefix ¶
func (c *CommandHandler) RemovePrefix(prefix string)
func (*CommandHandler) SetAllPrefixes ¶
func (c *CommandHandler) SetAllPrefixes(prefixes []string)
func (*CommandHandler) SetCheckPermissions ¶
func (c *CommandHandler) SetCheckPermissions(enable bool)
func (*CommandHandler) SetDebugFunc ¶
func (c *CommandHandler) SetDebugFunc(df DebugFunc)
func (*CommandHandler) SetEnable ¶
func (c *CommandHandler) SetEnable(enable bool)
func (*CommandHandler) SetHelpCommand ¶
func (c *CommandHandler) SetHelpCommand(name string, aliases []string, selfperms, userperms int, function HelpCommandFunc) error
func (*CommandHandler) SetIgnoreBots ¶
func (c *CommandHandler) SetIgnoreBots(enable bool)
func (*CommandHandler) SetOnErrorFunc ¶
func (c *CommandHandler) SetOnErrorFunc(oef OnErrorFunc)
func (*CommandHandler) SetOwners ¶
func (c *CommandHandler) SetOwners(ids []string)
func (*CommandHandler) SetPrerunFunc ¶
func (c *CommandHandler) SetPrerunFunc(prf PrerunFunc)
func (*CommandHandler) SetUseState ¶
func (c *CommandHandler) SetUseState(enable bool)
type CommandType ¶
type CommandType int
CommandType int
const ( CommandTypeEverywhere CommandType = iota // CommandTypeEverywhere : command can be used on everywhere (DMs + Guilds) CommandTypeGuild // CommandTypeGuild : command can be only used on guilds (not DMs) CommandTypePrivate // CommandTypePrivate : private command type )
type Context ¶
type Context struct { Handler *CommandHandler Channel *discordgo.Channel Guild *discordgo.Guild Member *discordgo.Member Message *discordgo.Message Session *discordgo.Session User *discordgo.User }
Context structure
func (*Context) Reply ¶
Reply sends a reply to message channel, returns *discordgo.Message and error
func (*Context) ReplyComplex ¶
func (c *Context) ReplyComplex(message string, tts bool, embed *discordgo.MessageEmbed, files []*discordgo.File) (*discordgo.Message, error)
ReplyComplex sends complex reply to message channel, returns *discordgo.Message and error
func (*Context) ReplyDiscordgoEmbed ¶ added in v1.7.0
ReplyDiscordgoEmbed replys to message channel with discordgo's embed
func (*Context) ReplyEmbed ¶
ReplyEmbed replys to message channel with embedutil's embed
type HelpCommand ¶
type HelpCommand struct { Aliases []string Name string SelfPermissions int UserPermissions int Run HelpCommandFunc }
HelpCommand struct
type HelpCommandFunc ¶
HelpCommandFunc is help command function
type OnErrorFunc ¶
OnErrorFunc is a function if error occurres on commands
Click to show internal directories.
Click to hide internal directories.