Documentation
¶
Index ¶
- Constants
- func ContainsString(slice []string, key string, ignoreCase bool) bool
- func DefaultAccess() func(ctx *Context) bool
- func DefaultMemberPermission() func(ctx *Context, member *discordgo.Member) bool
- func DefaultUserPermission() func(ctx *Context, user *discordgo.User) bool
- func DeregisterCommand(primaryKey string)
- func DeregisterCommands(primaryKeys ...string)
- func EqualsString(string1, string2 string, ignoreCase bool) bool
- func HandleCommandAction(session *discordgo.Session, compose *ComposedCommandAction)
- func IsCommandMessage(session *discordgo.Session, content string) bool
- func IsGuild(channel *discordgo.Channel) bool
- func KeepAlive()
- func ListenToMessageCreate(session *discordgo.Session)
- func ListenToMessageUpdate(session *discordgo.Session)
- func ReceiveCommandCreateMessage(session *discordgo.Session, event *discordgo.MessageCreate) error
- func ReceiveCommandUpdateMessage(session *discordgo.Session, event *discordgo.MessageUpdate) error
- func RegisterCommand(command Command)
- func RegisterCommands(commands ...Command)
- func UseConfiguration(configuration *Configuration)
- type Command
- type CommandConfiguration
- type CommandHandler
- type ComposedCommandAction
- type Configuration
- type Context
- type SimpleCommand
- func (cmd SimpleCommand) GetConfiguration() *CommandConfiguration
- func (cmd SimpleCommand) GetPrimaryKey() string
- func (cmd SimpleCommand) IsAccessibleBy(ctx *Context, user *discordgo.User) bool
- func (cmd SimpleCommand) IsMemberPermitted(ctx *Context, member *discordgo.Member) bool
- func (cmd SimpleCommand) IsNamed(key string, ignoreCase bool) bool
- func (cmd SimpleCommand) IsUserPermitted(ctx *Context, user *discordgo.User) bool
- func (cmd SimpleCommand) IsValidChannel(ctx *Context, channel *discordgo.Channel) bool
- func (cmd SimpleCommand) Run(ctx *Context) error
Constants ¶
View Source
const NoPermissionNeeded = -1
Variables ¶
This section is empty.
Functions ¶
func DefaultAccess ¶
func DefaultMemberPermission ¶
func DefaultUserPermission ¶
func DeregisterCommand ¶
func DeregisterCommand(primaryKey string)
func DeregisterCommands ¶
func DeregisterCommands(primaryKeys ...string)
func EqualsString ¶
func HandleCommandAction ¶
func HandleCommandAction(session *discordgo.Session, compose *ComposedCommandAction)
func ListenToMessageCreate ¶
func ListenToMessageUpdate ¶
func ReceiveCommandCreateMessage ¶
func ReceiveCommandCreateMessage(session *discordgo.Session, event *discordgo.MessageCreate) error
func ReceiveCommandUpdateMessage ¶
func ReceiveCommandUpdateMessage(session *discordgo.Session, event *discordgo.MessageUpdate) error
func RegisterCommand ¶
func RegisterCommand(command Command)
func RegisterCommands ¶
func RegisterCommands(commands ...Command)
func UseConfiguration ¶
func UseConfiguration(configuration *Configuration)
Types ¶
type Command ¶
type Command interface {
GetPrimaryKey() string
GetConfiguration() *CommandConfiguration
IsNamed(name string, ignoreCase bool) bool
IsAccessibleBy(ctx *Context, user *discordgo.User) bool
IsValidChannel(ctx *Context, channel *discordgo.Channel) bool
IsUserPermitted(ctx *Context, user *discordgo.User) bool
IsMemberPermitted(ctx *Context, member *discordgo.Member) bool
Run(ctx *Context) error
}
func FindCommands ¶
type CommandConfiguration ¶
type CommandHandler ¶
type CommandHandler struct {
NotPermitted func(ctx *Context, user *discordgo.User)
InvalidChannel func(ctx *Context, channel *discordgo.Channel)
NotAccessible func(ctx *Context, user *discordgo.User)
NoMatches func(ctx *Context)
NoPrefixGenerations func(compose *ComposedCommandAction)
PrefixNotFound func(compose *ComposedCommandAction)
Usage func(cmd Command, ctx *Context, err error)
UnknownError func(compose *ComposedCommandAction, err error)
}
type ComposedCommandAction ¶
type ComposedCommandAction struct {
Session *discordgo.Session
MessageCreate *discordgo.MessageCreate
MessageUpdate *discordgo.MessageUpdate
Message *discordgo.Message
Content string
Member *discordgo.Member
GuildID string
Reactions []*discordgo.MessageReactions
Tts bool
ChannelID string
Application *discordgo.MessageApplication
Activity *discordgo.MessageActivity
EditedTimestamp discordgo.Timestamp
Timestamp discordgo.Timestamp
Embeds []*discordgo.MessageEmbed
MessageReference *discordgo.MessageReference
Attachments []*discordgo.MessageAttachment
Author *discordgo.User
MessageType discordgo.MessageType
WebhookID string
Mentions []*discordgo.User
MentionChannels []*discordgo.Channel
MentionRoles []string
}
func ComposeMessageCreate ¶
func ComposeMessageCreate(session *discordgo.Session, create *discordgo.MessageCreate) *ComposedCommandAction
func ComposeMessageUpdate ¶
func ComposeMessageUpdate(session *discordgo.Session, update *discordgo.MessageUpdate) *ComposedCommandAction
func (ComposedCommandAction) IsCreate ¶
func (event ComposedCommandAction) IsCreate() bool
func (ComposedCommandAction) IsUpdate ¶
func (event ComposedCommandAction) IsUpdate() bool
type Configuration ¶
type Configuration struct {
PrefixGenerator func(channel *discordgo.Channel) []string
CommandHandler CommandHandler
}
type SimpleCommand ¶
type SimpleCommand struct {
Command
Keys []string `json:"keys"`
Configuration *CommandConfiguration `json:"configuration"`
Access func(ctx *Context) bool `json:"access"`
ValidChannel func(ctx *Context, channel *discordgo.Channel) bool `json:"valid_channel"`
UserPermitted func(ctx *Context, user *discordgo.User) bool `json:"user_permitted"`
MemberPermitted func(ctx *Context, member *discordgo.Member) bool `json:"member_permitted"`
Action func(ctx *Context) error `json:"action"`
}
func (SimpleCommand) GetConfiguration ¶
func (cmd SimpleCommand) GetConfiguration() *CommandConfiguration
func (SimpleCommand) GetPrimaryKey ¶
func (cmd SimpleCommand) GetPrimaryKey() string
func (SimpleCommand) IsAccessibleBy ¶
func (cmd SimpleCommand) IsAccessibleBy(ctx *Context, user *discordgo.User) bool
func (SimpleCommand) IsMemberPermitted ¶
func (cmd SimpleCommand) IsMemberPermitted(ctx *Context, member *discordgo.Member) bool
func (SimpleCommand) IsUserPermitted ¶
func (cmd SimpleCommand) IsUserPermitted(ctx *Context, user *discordgo.User) bool
func (SimpleCommand) IsValidChannel ¶
func (cmd SimpleCommand) IsValidChannel(ctx *Context, channel *discordgo.Channel) bool
func (SimpleCommand) Run ¶
func (cmd SimpleCommand) Run(ctx *Context) error
Click to show internal directories.
Click to hide internal directories.