// SortRoles sorts a given array of discordgo.Role // object references by position in ascending order. // If reversed, the order is descending. func SortRoles(r []*discordgo.Role, reversed bool) { … } // GetSortedMemberRoles tries to fetch the roles of a given // member on a given guild and returns the role array in // sorted ascending order by position. // If any error occurs, the error is returned as well. // If reversed, the order is descending. func GetSortedMemberRoles(s *discordgo.Session, guildID, memberID string, reversed bool, includeEveryone bool) ([]*discordgo.Role, error) { … } // GetSortedGuildRoles tries to fetch the roles of a given // guild and returns the role array in sorted ascending // order by position. // If any error occurs, the error is returned as well. // If reversed, the order is descending. func GetSortedGuildRoles(s *discordgo.Session, guildID string, reversed bool) ([]*discordgo.Role, error) { … } // PositionDiff : m1 position - m2 position // PositionDiff returns the difference number between // the top most role of member m1 and member m2 on // the specified guild g by subtracting // m1MaxPos - m2MaxPos. func PositionDiff(m1 *discordgo.Member, m2 *discordgo.Member, g *discordgo.Guild) int { … }