Documentation
¶
Index ¶
- func ContentWithMentionsRemoved(m *discordgo.Message) (content string)
- func GetChannelMention(s *discordgo.Session, msg, channelID string) *discordgo.Channel
- func GetChannelMentions(s *discordgo.Session, msg string) (cm []*discordgo.Channel)
- func GetHighestRole(guildroles []*discordgo.Role, uroles []string) (hp int)
- func GetMembersFromContent(s *discordgo.Session, guildID, content string) (ms []*discordgo.Member)
- func GetPermissionInt(arg string) int
- func GetPermissionIntAll(perms []string) (apermissions int)
- func GetPermissionSlice(perms, mode int) (apermissions []string)
- func GetPermissionString(perm, mode int) string
- func GetRoleByID(guildroles []*discordgo.Role, roleID string) (r *discordgo.Role)
- func GetRoleByName(guildroles []*discordgo.Role, rolename string) (r *discordgo.Role)
- func GetRoleByPosition(guildroles []*discordgo.Role, position int) (r *discordgo.Role)
- func GetRoleByProperty(guildRoles []*discordgo.Role, property RoleProperty, value interface{}) (r *discordgo.Role)
- func GetUserIDsFromMessage(s *discordgo.Session, m *discordgo.Message, guildID string) (u []string)
- func GetUsersFromMessage(s *discordgo.Session, m *discordgo.Message, guildID string) (u []*discordgo.User)
- func MemberHasPermission(guildRoles []*discordgo.Role, member *discordgo.Member, perm int) bool
- func MemberHasRole(userRoles []string, roleID string) bool
- type RoleProperty
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContentWithMentionsRemoved ¶
ContentWithMentionsRemoved returns the content with all user mentions removed. m : discordgo.Message struct.
func GetChannelMention ¶
GetChannelMention searches for a specific channel mention in the message content, returns discordgo.Channel if channel is found. s : discordgo.Session struct. channelID : The ChannelID of the channel you want. msg : content of the message.
func GetChannelMentions ¶
GetChannelMentions searches for all channel mention in the message content, returns slice of discordgo.Channel for channels found. s : discordgo.Session struct. msg : content of the message.
func GetHighestRole ¶
GetHighestRole returns an integer based on the highest role of a user. guildroles : Slice of the roles in a guild. uroles : Slice of IDs of the roles from a user.
func GetMembersFromContent ¶
GetMembersFromContent searches for all user snowflakes in the message content, returns slice of discordgo.Member. s : discordgo.Session struct. guildid : The guildID. msg : content of the message.
func GetPermissionInt ¶
GetPermissionInt returns an integer from a permission based on a string. arg : The a permission name.
func GetPermissionIntAll ¶
GetPermissionIntAll returns an integer consisting of (multiple) permissions based on a slice of strings. perms : Slice of strings of permission names.
func GetPermissionSlice ¶
GetPermissionSlice returns a slice of strings based on an integer consisting of (multiple) permissions. perms : Slice of strings of permission names. mode : Determines the string to return in some cases.
(e.g. Manage Roles <> Manage Permissions)
func GetPermissionString ¶
GetPermissionString returns a name from a permission based on a integer. perm : Integer of the permission. mode : Determines the string to return in some cases.
(e.g. Manage Roles <> Manage Permissions)
func GetRoleByID ¶
GetRoleByID returns a discordgo.Role struct based on an id, returns nil if not found. guildroles : Slice of the roles in a guild. roleID : ID of the role you want.
func GetRoleByName ¶
GetRoleByName returns a discordgo.Role struct based on a name, returns nil if not found. guildroles : Slice of the roles in a guild. rolename : Name of the role you want.
func GetRoleByPosition ¶
GetRoleByName returns a discordgo.Role struct based on a position, returns nil if not found. guildroles : Slice of the roles in a guild. position : Position of the role you want to be returned.
func GetRoleByProperty ¶
func GetRoleByProperty(guildRoles []*discordgo.Role, property RoleProperty, value interface{}) (r *discordgo.Role)
func GetUserIDsFromMessage ¶
func GetUsersFromMessage ¶
func MemberHasPermission ¶
MemberHasPermission checks if a member has the permission(s) from their roles. guildRoles : Slice of guild roles. member : discordgo.Member struct of the member. perm : Permission(s) you want to check.
func MemberHasRole ¶
MemberHasRole checks if a user has a role. userRoles : Slice of role IDs. roleID : ID of the role you want to check.
Types ¶
type RoleProperty ¶
type RoleProperty int
const ( RolePropertyName RoleProperty = 1 << iota RolePropertyID RolePropertyPosition )