Interface Member

    • Method Detail

      • getUser

        @Nonnull
        User getUser()
        The user wrapped by this Entity.
        Returns:
        User
      • getJDA

        @Nonnull
        JDA getJDA()
        The JDA instance.
        Returns:
        The current JDA instance.
      • getTimeJoined

        @Nonnull
        java.time.OffsetDateTime getTimeJoined()
        The Time this Member joined the Guild.
        If the member was loaded through a presence update (lazy loading) this will be identical to the creation time of the guild. You can use hasTimeJoined() to test whether this time can be relied on.

        You can use guild.retrieveMemberById(member.getId()) to load the join time.

        Returns:
        The time at which this user has joined the guild.
      • getTimeBoosted

        @Nullable
        java.time.OffsetDateTime getTimeBoosted()
        The time when this member boosted the guild.
        Null indicates this member is not currently boosting the guild.
        Returns:
        The boosting time, or null if the member is not boosting
        Since:
        4.0.0
      • getActivities

        @Nonnull
        java.util.List<Activity> getActivities()
        The activities of the user.
        If the user does not currently have any activity, this returns an empty list.

        This requires CacheFlag.ACTIVITY to be enabled!

        Returns:
        Immutable list of Activities for the user
      • getOnlineStatus

        @Nonnull
        OnlineStatus getOnlineStatus​(@Nonnull
                                     ClientType type)
        The platform dependent OnlineStatus of this member.
        Since a user can be connected from multiple different devices such as web and mobile, discord specifies a status for each ClientType.

        If a user is not online on the specified type, OFFLINE is returned.

        This requires CacheFlag.CLIENT_STATUS to be enabled!

        Parameters:
        type - The type of client
        Returns:
        The status for that specific client or OFFLINE
        Throws:
        java.lang.IllegalArgumentException - If the provided type is null
        Since:
        4.0.0
      • getActiveClients

        @Nonnull
        java.util.EnumSet<ClientType> getActiveClients()
        A Set of all active ClientTypes of this Member. Every OnlineStatus other than OFFLINE and UNKNOWN is interpreted as active. Since INVISIBLE is only possible for the SelfUser, other Members will never have ClientTypes show as active when actually being INVISIBLE, since they will show as OFFLINE.
        If the Member is currently not active with any Client, this returns an empty Set.
        When CacheFlag.CLIENT_STATUS is disabled, active clients will not be tracked and this will always return an empty Set.
        Since a user can be connected from multiple different devices such as web and mobile, discord specifies a status for each ClientType.
        Returns:
        EnumSet of all active ClientTypes
        Since:
        4.0.0
      • getNickname

        @Nullable
        java.lang.String getNickname()
        Returns the current nickname of this Member for the parent Guild.

        This can be changed using modifyNickname(Member, String).

        Returns:
        The nickname or null, if no nickname is set.
      • getEffectiveName

        @Nonnull
        java.lang.String getEffectiveName()
        Retrieves the Name displayed in the official Discord Client.
        Returns:
        The Nickname of this Member or the Username if no Nickname is present.
      • getAvatarId

        @Nullable
        java.lang.String getAvatarId()
        The Discord Id for this member's per guild avatar image. If the member has not set a per guild avatar, this will return null.
        Returns:
        Possibly-null String containing the Member per guild avatar id.
      • getAvatarUrl

        @Nullable
        default java.lang.String getAvatarUrl()
        The URL for the member's per guild avatar image. If the member has not set a per guild avatar, this will return null.
        Returns:
        Possibly-null String containing the Member per guild avatar url.
      • getEffectiveAvatarUrl

        @Nonnull
        default java.lang.String getEffectiveAvatarUrl()
        The URL for the member's effective avatar image. If they do not have a per guild avatar set, this will return the URL of their effective User avatar.
        Returns:
        Never-null String containing the Member avatar url.
      • getColor

        @Nullable
        java.awt.Color getColor()
        The Color of this Member's name in a Guild.

        This is determined by the color of the highest role assigned to them that does not have the default color.
        If all roles have default color, this returns null.

        Returns:
        The display Color for this Member.
        See Also:
        getColorRaw()
      • getColorRaw

        int getColorRaw()
        The raw RGB value for the color of this member.
        Defaulting to Role.DEFAULT_COLOR_RAW if this member uses the default color (special property, it changes depending on theme used in the client)
        Returns:
        The raw RGB value or the role default
      • canInteract

        boolean canInteract​(@Nonnull
                            Member member)
        Whether this Member can interact with the provided Member (kick/ban/etc.)
        Parameters:
        member - The target Member to check
        Returns:
        True, if this Member is able to interact with the specified Member
        Throws:
        java.lang.NullPointerException - if the specified Member is null
        java.lang.IllegalArgumentException - if the specified Member is not from the same guild
      • canInteract

        boolean canInteract​(@Nonnull
                            Role role)
        Whether this Member can interact with the provided Role (kick/ban/move/modify/delete/etc.)

        If this returns true this member can assign the role to other members.

        Parameters:
        role - The target Role to check
        Returns:
        True, if this member is able to interact with the specified Role
        Throws:
        java.lang.NullPointerException - if the specified Role is null
        java.lang.IllegalArgumentException - if the specified Role is not from the same guild
      • canInteract

        boolean canInteract​(@Nonnull
                            Emote emote)
        Whether this Member can interact with the provided Emote (use in a message)
        Parameters:
        emote - The target Emote to check
        Returns:
        True, if this Member is able to interact with the specified Emote
        Throws:
        java.lang.NullPointerException - if the specified Emote is null
        java.lang.IllegalArgumentException - if the specified Emote is not from the same guild
      • isOwner

        boolean isOwner()
        Checks whether this member is the owner of its related Guild.
        Returns:
        True, if this member is the owner of the attached Guild.
      • isPending

        @Incubating
        boolean isPending()
        Checks whether this member has passed the Guild's Membership Screening requirements.
        Returns:
        True, if this member hasn't passed the guild's Membership Screening requirements
        Since:
        4.2.1
        Incubating:
        Discord is still trying to figure this out
      • getDefaultChannel

        @Nullable
        TextChannel getDefaultChannel()
        The default TextChannel for a Member.
        This is the channel that the Discord client will default to opening when a Guild is opened for the first time after joining the guild.
        The default channel is the channel with the highest position in which the member has Permission.MESSAGE_READ permissions. If this requirement doesn't apply for any channel in the guild, this method returns null.
        Returns:
        The TextChannel representing the default channel for this member or null if no such channel exists.
      • ban

        @Nonnull
        @CheckReturnValue
        default AuditableRestAction<java.lang.Void> ban​(int delDays,
                                                        @Nullable
                                                        java.lang.String reason)
        Bans this Member and deletes messages sent by the user based on the amount of delDays.
        If you wish to ban a member without deleting any messages, provide delDays with a value of 0.

        You can unban a user with Guild.unban(User).

        Note: Guild.getMembers() will still contain the Member until Discord sends the GuildMemberRemoveEvent.

        Possible ErrorResponses caused by the returned RestAction include the following:

        • MISSING_PERMISSIONS
          The target Member cannot be banned due to a permission discrepancy
        • UNKNOWN_MEMBER
          The specified Member was removed from the Guild before finishing the task
        Parameters:
        delDays - The history of messages, in days, that will be deleted.
        reason - The reason for this action or null if there is no specified reason
        Returns:
        AuditableRestAction
        Throws:
        InsufficientPermissionException - If the logged in account does not have the Permission.BAN_MEMBERS permission.
        HierarchyException - If the logged in account cannot ban the other user due to permission hierarchy position.
        See canInteract(Member)
        java.lang.IllegalArgumentException -
        • If the provided amount of days (delDays) is less than 0.
        • If the provided amount of days (delDays) is bigger than 7.
        • If the provided reason is longer than 512 characters.
        Since:
        4.0.0