Documentation
¶
Index ¶
- Variables
- func BuildComboDisplay(cmd *Command) string
- func BuildPositionalDisplay(cmd *Command) string
- type Arg
- type ArgumentType
- type Command
- type CommandCategory
- type CommandHandler
- func (c *CommandHandler) HandleMessageCreate(s *discordgo.Session, e *discordgo.MessageCreate)
- func (c *CommandHandler) RegisterCommands(cmds ...*Command)
- func (c *CommandHandler) RegisteredCommands() map[string]RegisteredCommand
- func (c *CommandHandler) SetPrefixFunc(prefixFunc func(string) string)
- type Data
- type DurationArg
- type Int64Arg
- type IntArg
- type MemberArg
- type ParsedArg
- type RegisteredCommand
- type Run
- type StringArg
- type UserArg
Constants ¶
This section is empty.
Variables ¶
var ( String = &StringArg{} Int = &IntArg{} Int64 = &Int64Arg{} User = &UserArg{} Member = &MemberArg{} Duration = &DurationArg{} )
var PermissionNames = map[int64]string{ discordgo.PermissionViewChannel: "View Channel", discordgo.PermissionSendMessages: "Send Messages", discordgo.PermissionSendTTSMessages: "Send TTS Messages", discordgo.PermissionManageMessages: "Manage Messages", discordgo.PermissionEmbedLinks: "Embed Links", discordgo.PermissionAttachFiles: "Attach Files", discordgo.PermissionReadMessageHistory: "Read Message History", discordgo.PermissionMentionEveryone: "Mention Everyone", discordgo.PermissionAddReactions: "Add Reactions", discordgo.PermissionKickMembers: "Kick Members", discordgo.PermissionBanMembers: "Ban Members", discordgo.PermissionModerateMembers: "Timeout Members", discordgo.PermissionAdministrator: "Administrator", discordgo.PermissionManageNicknames: "Manage Nicknames", discordgo.PermissionManageRoles: "Manage Roles", discordgo.PermissionManageChannels: "Manage Channels", discordgo.PermissionManageGuild: "Manage Server", discordgo.PermissionViewAuditLogs: "View Audit Log", discordgo.PermissionCreateInstantInvite: "Create Invite", }
PermissionNames maps Discord permission bit values to human readable names.
Functions ¶
func BuildComboDisplay ¶
BuildComboDisplay returns the usage for argument combos Exported for use in custom help functions
func BuildPositionalDisplay ¶
BuildPositionalDisplay returns the usage for positional args Exported for use in custom help functions
Types ¶
type Arg ¶
type Arg struct {
Name string
Type ArgumentType
}
Arg defines the structure to pass argument data with
type ArgumentType ¶
type Command ¶
type Command struct {
Command string
Category CommandCategory
Aliases []string
Description string
Args []*Arg
ArgsRequired int // Ignored if using combos
ArgumentCombos [][]int
RequiredUserPerms []int64
RequiredBotPerms []int64
Run Run
}
Command defines the general data that must be set during the addition of a new command
type CommandCategory ¶
CommandCategory defines the available category types for commands
type CommandHandler ¶
CommandHandler contains the prefix, the full instances of a command and a string map to retireve them
func NewCommandHandler ¶
func NewCommandHandler() *CommandHandler
NewCommandHandler creates a new command handler
func (*CommandHandler) HandleMessageCreate ¶
func (c *CommandHandler) HandleMessageCreate(s *discordgo.Session, e *discordgo.MessageCreate)
Handles all message create events to the bot, to pass them to child functions
func (*CommandHandler) RegisterCommands ¶
func (c *CommandHandler) RegisterCommands(cmds ...*Command)
RegisterCommands adds each command to the command handler
func (*CommandHandler) RegisteredCommands ¶
func (c *CommandHandler) RegisteredCommands() map[string]RegisteredCommand
RegisteredCommands returns an array of each RegisteredCommand
func (*CommandHandler) SetPrefixFunc ¶
func (c *CommandHandler) SetPrefixFunc(prefixFunc func(string) string)
SetPrefixFunc allows you to set a custom function to determine the prefix for a guild
type Data ¶
type Data struct {
Session *discordgo.Session
Bot *discordgo.User
Guild *discordgo.Guild
Channel *discordgo.Channel
Author *discordgo.User
Message *discordgo.Message
ParsedArgs []*ParsedArg
Handler *CommandHandler
}
Data defines the required data passed to each command
type DurationArg ¶
type DurationArg struct{}
func (*DurationArg) Help ¶
func (d *DurationArg) Help() string
type ParsedArg ¶
ParsedArg represents a single argument parsed from a command invocation. Each argument contains the initial argument definition, the raw value passed to it, and the resolved value
type RegisteredCommand ¶
type RegisteredCommand struct {
Command *Command
}
RegisteredCommand defines the context required to access data surrounding a command