Class RestMember


  • public class RestMember
    extends Object
    Represents a user (bot or normal) that is member of a specific guild.
    • Method Detail

      • create

        public static RestMember create​(RestClient restClient,
                                        Snowflake guildId,
                                        Snowflake id)
        Create a RestMember with the given parameters. This method does not perform any API request.
        Parameters:
        restClient - REST API resources
        guildId - the ID of the guild this member belongs to
        id - the ID of this member
        Returns:
        a RestMember represented by the given parameters.
      • getGuildId

        public Snowflake getGuildId()
        Returns the ID of the guild this member belongs to.
        Returns:
        The ID of the the guild this member belongs to.
      • getId

        public Snowflake getId()
        Returns the ID of this member.
        Returns:
        The ID of this member
      • guild

        public RestGuild guild()
        Create a RestGuild with data from this Member. This method does not perform any API request.
        Returns:
        a RestGuild represented by the data from this Member
      • user

        public RestUser user()
        Create a RestUser with daa from this Member. This method does not perform any API request.
        Returns:
        a RestUser represented by the data from this Member
      • getData

        public Mono<discord4j.discordjson.json.MemberData> getData()
        Requests to retrieve the Member's MemberData
        Returns:
        A Mono where, upon successful completion, emits the Member's MemberData. If an error is received, it is emitted through the Mono.
      • getHighestRole

        public Mono<discord4j.discordjson.json.RoleData> getHighestRole()
        Requests to retrieve the member's highest guild role.

        The highest role is defined to be the role with the highest position, based on Discord's ordering. This is the role that appears at the top in Discord's UI.

        Returns:
        A Mono where, upon successful completion, emits the member's highest role. If an error is received, it is emitted through the Mono.
      • isHigher

        public Mono<Boolean> isHigher​(RestMember otherMember)
        Requests to determine if this member is higher in the role hierarchy than the provided member or signal IllegalArgumentException if the provided member is in a different guild than this member.
        Parameters:
        otherMember - The member to compare in the role hierarchy with this member.
        Returns:
        A Mono where, upon successful completion, emits true if this member is higher in the role hierarchy than the provided member, false otherwise. If an error is received, it is emitted through the @{code Mono}.
      • isHigher

        public Mono<Boolean> isHigher​(Snowflake id)
        Requests to determine if this member is nigher in the role hierarchy than the member as represented by the supplied ID or signal IllegalArgumentException if the member as represented by the supplied ID is in a different guild than this member. This is determined by the positions of each of the members' highest roles.
        Parameters:
        id - The ID of the member to compare in the role hierarchy with this member.
        Returns:
        A Mono where, upon successful completion, emits true if this member is higher in the role hierarchy than the member as represented by the supplied ID, false otherwise. If an error is received, it is emitted through the Mono.
      • hasHigherRoles

        public Mono<Boolean> hasHigherRoles​(Collection<Snowflake> otherRoles)
        Requests to determine if the position of this member's highest role is greater than the highest position of the provided roles.

        The behavior of this operation is undefined if a given role is from a different guild.

        Parameters:
        otherRoles - The collection of roles to compare in the role hierarchy with this member's roles.
        Returns:
        A Mono where, upon successful completion, emits true if the position of this member's highest role is greater than the highest position of the provided roles, false otherwise. If an error is received, it is emitted through the Mono.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object