Documentation ¶
Index ¶
- Variables
- func GetCreationTime(ID string) (t time.Time, err error)
- type Command
- type Context
- func (ctx *Context) GetAllUsers() (ms []*discordgo.User, err error)
- func (ctx *Context) GetUser(args ...string) (user *discordgo.User, err error)
- func (ctx *Context) GetUserByName(query string) (members []*discordgo.User, err error)
- func (ctx *Context) GuildGetUserByName(query, GuildID string) (members []*discordgo.User, err error)
- func (ctx *Context) ParseTooManyUsers(query string, users []*discordgo.User) (*discordgo.Message, error)
- func (ctx *Context) QuickSendEmbed(s string) (*discordgo.Message, error)
- func (ctx *Context) SendEmbed(em *discordgo.MessageEmbed) (*discordgo.Message, error)
- func (ctx *Context) SendMessage(s string) (*discordgo.Message, error)
- type ExtSession
- func (s *ExtSession) AddCommand(category string, c *Command)
- func (s *ExtSession) AddPrivateCommand(category string, check func(ctx *Context) bool, c *Command)
- func (s *ExtSession) ChangeMessageHandler(handler func(s *discordgo.Session, m *discordgo.MessageCreate))
- func (s *ExtSession) CreateEmbed(ctx *Context) *discordgo.MessageEmbed
- func (s *ExtSession) HandleCommands(ctx *Context)
- func (s *ExtSession) HandleSubcommands(ctx *Context, called *Command) (*Context, *Command)
- func (s *ExtSession) HelpFunction(ctx *Context)
Constants ¶
This section is empty.
Variables ¶
var ErrUserFinding = errors.New("Found more than 1 or no users")
ErrUserFinding is the error it gives when more than 1 or no users are found, used to return commands.
Functions ¶
Types ¶
type Command ¶
type Command struct { Name string OnMessage func(ctx *Context) Description string Usage string Detailed string Subcommands []*Command Category string Check func(ctx *Context) bool }
The Command structy stores the command.
func NewCommand ¶
func NewCommand(name, description, usage, detaileddescription string, onmessage func(ctx *Context)) *Command
NewCommand handles the creation of Commands.
func (*Command) AddSubCommand ¶
AddSubCommand handles the addition of extra subcommands to an existing command
type Context ¶
type Context struct { Invoked string Argstr string Args []string Channel *discordgo.Channel Guild *discordgo.Guild Mess *discordgo.MessageCreate Sess *ExtSession }
A Context struct holds variables for Messages
func (*Context) GetAllUsers ¶
GetAllUsers is a helper function to return all members
func (*Context) GetUserByName ¶
GetUserByName is a helper function to find a User by string query: String to use when finding User
func (*Context) GuildGetUserByName ¶
func (ctx *Context) GuildGetUserByName(query, GuildID string) (members []*discordgo.User, err error)
GuildGetUserByName is a helper function to find a User by string in a guild query: String to use when finding User GuildID: ID for guild
func (*Context) ParseTooManyUsers ¶
func (ctx *Context) ParseTooManyUsers(query string, users []*discordgo.User) (*discordgo.Message, error)
ParseTooManyUsers is a helper function to create a message for finding too many users query: String used when finding User users: List of users found
func (*Context) QuickSendEmbed ¶
QuickSendEmbed is a helper function to easily send strings as an embed. s: string to send
type ExtSession ¶
type ExtSession struct { *discordgo.Session Token string Prefix string Bot bool Commands []*Command // contains filtered or unexported fields }
ExtSession handles the bot and it's commands.
func New ¶
func New(token, prefix string, userbot bool) (*ExtSession, error)
New creates a ExtSession from a token.
func (*ExtSession) AddCommand ¶
func (s *ExtSession) AddCommand(category string, c *Command)
AddCommand handles the adding of Commands to the handler.
func (*ExtSession) AddPrivateCommand ¶
func (s *ExtSession) AddPrivateCommand(category string, check func(ctx *Context) bool, c *Command)
AddPrivateCommand handles the adding of Private Commands to the handler.
func (*ExtSession) ChangeMessageHandler ¶
func (s *ExtSession) ChangeMessageHandler(handler func(s *discordgo.Session, m *discordgo.MessageCreate))
ChangeMessageHandler handles the changing of the message handler (Lots of handlers.)
func (*ExtSession) CreateEmbed ¶
func (s *ExtSession) CreateEmbed(ctx *Context) *discordgo.MessageEmbed
CreateEmbed handles the easy creation of Embeds.
func (*ExtSession) HandleCommands ¶
func (s *ExtSession) HandleCommands(ctx *Context)
HandleCommands handles the Context and calls Command ctx: Context used
func (*ExtSession) HandleSubcommands ¶
func (s *ExtSession) HandleSubcommands(ctx *Context, called *Command) (*Context, *Command)
HandleSubcommands returns the Context and Command that is being called ctx: Context used called: Command called
func (*ExtSession) HelpFunction ¶
func (s *ExtSession) HelpFunction(ctx *Context)
HelpFunction handles the Help command for the CommandHandler ctx: Context used