Documentation ¶
Index ¶
- Variables
- func CommandHandler(e *gateway.MessageCreateEvent)
- func CommandHandlerWithCommand(e *gateway.MessageCreateEvent, cmdName string, cmdArgs []string)
- func CreateEmbedAuthor(member discord.Member) *discord.EmbedAuthor
- func CreateEmbedAuthorUser(user discord.User) *discord.EmbedAuthor
- func CreateMessageLink(guild int64, message *discord.Message, jump, dm bool) string
- func CreateMessageLinkInt64(guild, message, channel int64, jump, dm bool) string
- func FileExtMatches(s []string, file string) bool
- func GetEmbedAttachmentAndContent(msg discord.Message) (string, *discord.EmbedImage)
- func GivePermission(c bot.Command, pStr string, id int64) error
- func HasAdminCached(id discord.GuildID, memberRoles []discord.RoleID, user discord.User) bool
- func HasPermission(c bot.Command, p Permission) *bot.Error
- func MakeEmbed(title string, description string, color discord.Color) discord.Embed
- func ParseAllArgs(a []string) (string, *bot.Error)
- func ParseBoolArg(a []string, pos int) (bool, *bot.Error)
- func ParseChannelArg(a []string, pos int) (int64, *bot.Error)
- func ParseChannelSliceArg(a []string, pos1 int, pos2 int) ([]int64, *bot.Error)
- func ParseDurationArg(a []string, pos int) (time.Duration, *bot.Error)
- func ParseEmojiArg(a []string, pos int, allowOmit bool) (*discord.APIEmoji, bool, *bot.Error)
- func ParseEmojiIdArg(a []string, pos int) (int64, *bot.Error)
- func ParseEmojiUrlArg(a []string, pos int) (int64, *bot.Error)
- func ParseInt64Arg(a []string, pos int) (int64, *bot.Error)
- func ParseInt64SliceArg(a []string, pos1 int, pos2 int) ([]int64, *bot.Error)
- func ParseStringArg(a []string, pos int, toLower bool) (string, *bot.Error)
- func ParseStringSliceArg(a []string, pos1 int, pos2 int) ([]string, *bot.Error)
- func ParseUrlArg(a []string, pos int) (string, *bot.Error)
- func ParseUserArg(a []string, pos int) (int64, *bot.Error)
- func ResponseHandler(e *gateway.MessageCreateEvent)
- func SendCustomEmbed(c discord.ChannelID, e ...discord.Embed) (*discord.Message, error)
- func SendCustomMessage(c discord.ChannelID, content string) (*discord.Message, error)
- func SendDirectMessage(userID discord.UserID, contents string) (*discord.Message, error)
- func SendDirectMessageEmbedSafe(id discord.UserID, content string, embed *discord.Embed) (*discord.Message, error)
- func SendEmbed(e *gateway.MessageCreateEvent, title, description string, color discord.Color) (*discord.Message, error)
- func SendEmbedFooter(e *gateway.MessageCreateEvent, title, description, footer string, ...) (*discord.Message, error)
- func SendErrorEmbed(c bot.Command, err error)
- func SendExternalErrorEmbed(c discord.ChannelID, cmdName string, err error) (*discord.Message, error)
- func SendMessage(e *gateway.MessageCreateEvent, content string) (*discord.Message, error)
- func SendMessageEmbedSafe(c discord.ChannelID, content string, embed *discord.Embed) (*discord.Message, error)
- func UpdateMemberCache(e *gateway.GuildMemberUpdateEvent)
- func UserHasPermission(c bot.Command, p Permission, id int64) bool
- type Permission
Constants ¶
This section is empty.
Variables ¶
var ( Permissions = []Permission{PermUndefined, PermChannels, PermPermissions, PermModerate, PermOperator} PermissionCache = permissionCache{} )
var (
ImageExtensions = []string{".jpg", ".jpeg", ".png", ".gif", ".gifv"}
)
var (
UrlRegex = regexp.MustCompile(`https?://(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}([.:])[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&/=]*)`)
)
Functions ¶
func CommandHandler ¶
func CommandHandler(e *gateway.MessageCreateEvent)
CommandHandler will parse commands and run the appropriate command func
func CommandHandlerWithCommand ¶
func CommandHandlerWithCommand(e *gateway.MessageCreateEvent, cmdName string, cmdArgs []string)
func CreateEmbedAuthor ¶
func CreateEmbedAuthor(member discord.Member) *discord.EmbedAuthor
func CreateEmbedAuthorUser ¶
func CreateEmbedAuthorUser(user discord.User) *discord.EmbedAuthor
func CreateMessageLink ¶
func CreateMessageLinkInt64 ¶
func FileExtMatches ¶
func GetEmbedAttachmentAndContent ¶
func GetEmbedAttachmentAndContent(msg discord.Message) (string, *discord.EmbedImage)
func GivePermission ¶
GivePermission will return nil if the permission was successfully given to the user with a matching id
func HasAdminCached ¶
func HasPermission ¶
func HasPermission(c bot.Command, p Permission) *bot.Error
HasPermission will return if the author of a command has said permission
func ParseAllArgs ¶
ParseAllArgs will return the combined existing args
func ParseBoolArg ¶
ParseBoolArg will return a bool (True / true / 1), or false with an error
func ParseChannelArg ¶
ParseChannelArg will return the ID of a mentioned channel, or -1 and an error
func ParseChannelSliceArg ¶
ParseChannelSliceArg will return the IDs of the mentioned channels, or nil and an error
func ParseEmojiArg ¶
ParseEmojiArg will return a discord.APIEmoji and the animated status, or nil, false and an error
func ParseEmojiIdArg ¶
ParseEmojiIdArg will return an emoji ID, or -1 and an error
func ParseEmojiUrlArg ¶
ParseEmojiUrlArg will return an emoji ID, or -1 and an error
func ParseInt64Arg ¶
ParseInt64Arg will return an int64 from s, or -1 and an error
func ParseInt64SliceArg ¶
ParseInt64SliceArg will return an []int64, or nil and an error
func ParseStringArg ¶
ParseStringArg will return the selected string, or "" with an error
func ParseStringSliceArg ¶
ParseStringSliceArg will return the strings in a range, or a nil and an error
func ParseUrlArg ¶
ParseUrlArg will return a URL, or "" and an error
func ParseUserArg ¶
ParseUserArg will return the ID of a mentioned user, or -1 and an error
func ResponseHandler ¶
func ResponseHandler(e *gateway.MessageCreateEvent)
ResponseHandler will find a global response from the config and send it, if found
func SendCustomEmbed ¶
func SendCustomMessage ¶
func SendDirectMessage ¶
func SendEmbedFooter ¶
func SendErrorEmbed ¶
func SendExternalErrorEmbed ¶
func SendMessage ¶
func SendMessageEmbedSafe ¶
func UpdateMemberCache ¶
func UpdateMemberCache(e *gateway.GuildMemberUpdateEvent)
UpdateMemberCache will forcibly update the member cache
func UserHasPermission ¶
func UserHasPermission(c bot.Command, p Permission, id int64) bool
UserHasPermission will return if the user with id has said permission
Types ¶
type Permission ¶
type Permission int64
const ( PermUndefined Permission = iota PermChannels PermPermissions PermModerate PermOperator // "operator" is a special permission, managed by bot.C.OperatorIDs )
func GetPermission ¶
func GetPermission(pStr string) Permission
GetPermission will return a valid Permission type from a string
func (Permission) String ¶
func (p Permission) String() string