Class MemberImpl

    • Constructor Detail

      • MemberImpl

        public MemberImpl​(DiscordApiImpl api,
                          ServerImpl server,
                          com.fasterxml.jackson.databind.JsonNode data,
                          UserImpl user)
        Creates a new immutable member instance.
        Parameters:
        api - The api instance.
        server - The server of the member.
        data - The json data of the member.
        user - A user object in case the json does not contain user data (e.g., for message create events). If the json contains a non-null user field, this parameter is ignored.
    • Method Detail

      • setUser

        public MemberImpl setUser​(UserImpl user)
        Creates a new member object with the new user.
        Parameters:
        user - The new user.
        Returns:
        The new member.
      • setPartialUser

        public MemberImpl setPartialUser​(com.fasterxml.jackson.databind.JsonNode partialUserJson)
        Creates a new member object with the new partial user data.
        Parameters:
        partialUserJson - The new partial user data.
        Returns:
        The new member.
      • setRoleIds

        public MemberImpl setRoleIds​(java.util.List<java.lang.Long> roleIds)
        Creates a new member object with the new role ids.
        Parameters:
        roleIds - The new role ids.
        Returns:
        The new member.
      • getRoleIds

        public java.util.List<java.lang.Long> getRoleIds()
        Gets the member's role ids.
        Returns:
        The member's role ids.
      • setNickname

        public MemberImpl setNickname​(java.lang.String nickname)
        Creates a new member object with the new nickname.
        Parameters:
        nickname - The new nickname.
        Returns:
        The new member.
      • setTimeout

        public MemberImpl setTimeout​(java.time.Instant timeout)
        Creates a new member object with the new timeout.
        Parameters:
        timeout - The instant until the user should be timeout.
        Returns:
        The new member.
      • setServerBoostingSince

        public MemberImpl setServerBoostingSince​(java.lang.String serverBoostingSince)
        Creates a new member object with the new server boosting since timestamp.
        Parameters:
        serverBoostingSince - The new timestamp when the user started boosting the server.
        Returns:
        The new member.
      • getServerBoostingSince

        public java.lang.String getServerBoostingSince()
        Gets the string value of the server boosting since field.
        Returns:
        The server boosting since field.
      • setMuted

        public MemberImpl setMuted​(boolean muted)
        Creates a new member object with the new muted status.
        Parameters:
        muted - Whether the user is muted or not.
        Returns:
        The new member.
      • setDeafened

        public MemberImpl setDeafened​(boolean deafened)
        Creates a new member object with the new deafened status.
        Parameters:
        deafened - Whether the user is deafened or not.
        Returns:
        The new member.
      • setSelfMuted

        public MemberImpl setSelfMuted​(boolean selfMuted)
        Creates a new member object with the new self-muted status.
        Parameters:
        selfMuted - Whether the user is self-muted or not.
        Returns:
        The new member.
      • setSelfDeafened

        public MemberImpl setSelfDeafened​(boolean selfDeafened)
        Creates a new member object with the new self-deafened status.
        Parameters:
        selfDeafened - Whether the user is self-deafened or not.
        Returns:
        The new member.
      • getServer

        public Server getServer()
        Description copied from interface: Member
        Gets the server, this user is a part of.
        Specified by:
        getServer in interface Member
        Returns:
        The server.
      • getUser

        public User getUser()
        Description copied from interface: Member
        Gets the user object linked to this member.
        Specified by:
        getUser in interface Member
        Returns:
        The user.
      • getNickname

        public java.util.Optional<java.lang.String> getNickname()
        Description copied from interface: Member
        Gets the nickname of this member.
        Specified by:
        getNickname in interface Member
        Returns:
        The nickname of this member.
      • getRoles

        public java.util.List<Role> getRoles()
        Description copied from interface: Member
        Gets a sorted list (by position) with all roles of this member.
        Specified by:
        getRoles in interface Member
        Returns:
        A sorted list (by position) with all roles of this member.
      • hasRole

        public boolean hasRole​(Role role)
        Description copied from interface: Member
        Checks if this member has the given role.
        Specified by:
        hasRole in interface Member
        Parameters:
        role - The role to check.
        Returns:
        Whether the member has the role or not.
      • getRoleColor

        public java.util.Optional<java.awt.Color> getRoleColor()
        Description copied from interface: Member
        Gets the displayed color of this member based on his roles.
        Specified by:
        getRoleColor in interface Member
        Returns:
        The color.
      • getServerAvatarHash

        public java.util.Optional<java.lang.String> getServerAvatarHash()
        Description copied from interface: Member
        Gets the member's server avatar hash.
        Specified by:
        getServerAvatarHash in interface Member
        Returns:
        The member's server avatar hash.
      • getServerAvatar

        public java.util.Optional<Icon> getServerAvatar()
        Description copied from interface: Member
        Gets the member's server avatar.
        Specified by:
        getServerAvatar in interface Member
        Returns:
        The member's server avatar.
      • getServerAvatar

        public java.util.Optional<Icon> getServerAvatar​(int size)
        Description copied from interface: Member
        Gets the member's server avatar in the given size.
        Specified by:
        getServerAvatar in interface Member
        Parameters:
        size - The size of the image, must be any power of 2 between 16 and 4096.
        Returns:
        The member's server avatar in the given size.
      • getJoinedAtTimestamp

        public java.time.Instant getJoinedAtTimestamp()
        Description copied from interface: Member
        Gets the timestamp of when this member joined the server.
        Specified by:
        getJoinedAtTimestamp in interface Member
        Returns:
        The timestamp of when this member joined the server.
      • getServerBoostingSinceTimestamp

        public java.util.Optional<java.time.Instant> getServerBoostingSinceTimestamp()
        Description copied from interface: Member
        Gets the timestamp of when this member started boosting the server.
        Specified by:
        getServerBoostingSinceTimestamp in interface Member
        Returns:
        The timestamp of when this member started boosting the server.
      • isMuted

        public boolean isMuted()
        Description copied from interface: Member
        Gets the muted state of this member.
        Specified by:
        isMuted in interface Member
        Returns:
        Whether or not this member is muted.
      • isDeafened

        public boolean isDeafened()
        Description copied from interface: Member
        Gets the deafened state of this member.
        Specified by:
        isDeafened in interface Member
        Returns:
        Whether or not this member is deafened.
      • isSelfMuted

        public boolean isSelfMuted()
        Description copied from interface: Member
        Gets the self-muted state of this member.
        Specified by:
        isSelfMuted in interface Member
        Returns:
        Whether this member is self-muted.
      • isSelfDeafened

        public boolean isSelfDeafened()
        Description copied from interface: Member
        Gets the self-deafened state of this member.
        Specified by:
        isSelfDeafened in interface Member
        Returns:
        Whether this member is self-deafened.
      • isPending

        public boolean isPending()
        Description copied from interface: Member
        Gets the pending state of this member.
        Specified by:
        isPending in interface Member
        Returns:
        Whether this user has passed the membership screening.
      • getTimeout

        public java.util.Optional<java.time.Instant> getTimeout()
        Description copied from interface: Member
        Gets the timestamp of the timeout when the timeout will expire and the user will be able to communicate in the server again. The returned Instant may be in the past which indicates that the user is not timed out.
        Specified by:
        getTimeout in interface Member
        Returns:
        The timestamp of when this member will no longer be timed out.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object