roleutil

package
v0.0.0-...-553821e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 25, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package roleutil provides general purpose utilities for discordgo.Role objects and arrays.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSortedGuildRoles

func GetSortedGuildRoles(s discordutil.ISession, guildID string, reversed 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 GetSortedMemberRoles

func GetSortedMemberRoles(s discordutil.ISession, guildID, memberID string, reversed bool, includeEveryone bool) ([]*discordgo.Role, error)

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 PositionDiff

func PositionDiff(m1 *discordgo.Member, m2 *discordgo.Member, g *discordgo.Guild) int

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 SortRoles

func SortRoles(r []*discordgo.Role, reversed bool)

SortRoles sorts a given array of discordgo.Role object references by position in ascending order. If reversed, the order is descending.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL