Class MemberImpl
- All Implemented Interfaces:
Formattable
,IDetachableEntity
,IMentionable
,IPermissionHolder
,ISnowflake
,Member
,UserSnowflake
,IDetachableEntityMixin
,MemberMixin<MemberImpl>
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.dv8tion.jda.api.entities.Member
Member.MemberFlag
-
Field Summary
Fields inherited from interface net.dv8tion.jda.api.entities.Member
AVATAR_URL, MAX_TIME_OUT_LENGTH
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
canInteract
(RichCustomEmoji emoji) Whether this Member can interact with the providedRichCustomEmoji
(use in a message)boolean
canInteract
(Member member) Whether this Member can interact with the provided Member (kick/ban/etc.)boolean
canInteract
(Role role) Whether this Member can interact with the providedRole
(kick/ban/move/modify/delete/etc.)boolean
canSync
(IPermissionContainer channel) Whether the permissions of this PermissionHolder are good enough to sync the target channel with any other channel.boolean
canSync
(IPermissionContainer targetChannel, IPermissionContainer syncSource) Whether the permissions of this PermissionHolder are good enough to sync the target channel with the sync source.boolean
A Set of all activeClientTypes
of this Member.The activities of the user.Retrieve a Mention for this Entity.The Discord Id for this member's per guild avatar image.long
getColor()
TheColor
of this Member's name in a Guild.int
The raw RGB value for the color of this member.The Discord ID for this user's default avatar image.Thedefault channel
for aMember
.Retrieves the Name displayed in the official Discord Client.int
The rawflags
bitset for this member.getGuild()
The Guild in which this Member is represented.long
The Snowflake id of this entity.getJDA()
The JDA instance.Returns the current nickname of this Member for the parent Guild.Returns theOnlineStatus
of the User.getOnlineStatus
(ClientType type) The platform dependentOnlineStatus
of this member.The Guild-Wide Permissions this PermissionHolder holds.getPermissions
(GuildChannel channel) The Permissions this PermissionHolder holds in the specifiedGuildChannel
.The explicitly granted permissions for this permission holder in the guild.getPermissionsExplicit
(GuildChannel channel) The explicitly granted permissions for this permission holder in the guild.getRoles()
The roles applied to this Member.The time when this member boosted the guild.TheTime
this Member joined the Guild.The time this Member will be released from time out.long
The roles applied to this Member.getUser()
The user wrapped by this Entity.TheVoiceState
of this Member.int
hashCode()
boolean
hasPermission
(GuildChannel channel, Permission... permissions) Checks whether or not this PermissionHolder has the givenPermissions
in the specified GuildChannel.boolean
hasPermission
(Permission... permissions) Checks whether or not this PermissionHolder has the givenPermissions
in the Guild.boolean
Whether this member has accurateMember.getTimeJoined()
information.boolean
Returns whether a member is boosting the guild or not.boolean
Whether this entity is detached.boolean
isOwner()
Checks whether this member is the owner of its relatedGuild
.boolean
Checks whether this member has passed theGuild's
Membership Screening requirements.setAvatarId
(String avatarId) setBoostDate
(long boostDate) setFlags
(int flags) setJoinDate
(long joinDate) setNickname
(String nickname) setPending
(boolean pending) setTimeOutEnd
(long time) toString()
Methods inherited from interface net.dv8tion.jda.internal.entities.detached.mixin.IDetachableEntityMixin
checkAttached, detachedException, detachedRequiresChannelException
Methods inherited from interface net.dv8tion.jda.api.entities.IMentionable
formatTo
Methods inherited from interface net.dv8tion.jda.api.entities.IPermissionHolder
hasAccess, hasPermission, hasPermission
Methods inherited from interface net.dv8tion.jda.api.entities.ISnowflake
getId, getTimeCreated
Methods inherited from interface net.dv8tion.jda.api.entities.Member
ban, deafen, getAvatar, getAvatarUrl, getEffectiveAvatar, getEffectiveAvatarUrl, getFlags, isTimedOut, kick, modifyFlags, modifyNickname, mute, removeTimeout, timeoutFor, timeoutFor, timeoutUntil
Methods inherited from interface net.dv8tion.jda.api.entities.UserSnowflake
getDefaultAvatar, getDefaultAvatarUrl
-
Constructor Details
-
MemberImpl
-
-
Method Details
-
isDetached
public boolean isDetached()Description copied from interface:IDetachableEntity
Whether this entity is detached.If this returns
true
, this entity cannot be retrieved, will never be updated, and most methods that would otherwise return aRestAction
will throw aDetachedEntityException
instead.- Specified by:
isDetached
in interfaceIDetachableEntity
- Returns:
True
, if the entity is detached
-
getPresence
-
getUser
Description copied from interface:Member
The user wrapped by this Entity. -
getGuild
Description copied from interface:Member
The Guild in which this Member is represented.- Specified by:
getGuild
in interfaceIPermissionHolder
- Specified by:
getGuild
in interfaceMember
- Returns:
Guild
-
getJDA
Description copied from interface:Member
The JDA instance. -
getTimeJoined
Description copied from interface:Member
TheTime
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 useMember.hasTimeJoined()
to test whether this time can be relied on.You can use
guild.retrieveMemberById(member.getId())
to load the join time.- Specified by:
getTimeJoined
in interfaceMember
- Returns:
- The time at which this user has joined the guild.
-
hasTimeJoined
public boolean hasTimeJoined()Description copied from interface:Member
Whether this member has accurateMember.getTimeJoined()
information.
Discord doesn't always provide this information when we load members so we have to fallback to theGuild
creation time.You can use
guild.retrieveMemberById(member.getId())
to load the join time.- Specified by:
hasTimeJoined
in interfaceMember
- Returns:
- True, if
Member.getTimeJoined()
is accurate
-
getTimeBoosted
Description copied from interface:Member
The time when this member boosted the guild.
Null indicates this member is not currently boosting the guild.- Specified by:
getTimeBoosted
in interfaceMember
- Returns:
- The boosting time, or null if the member is not boosting
-
isBoosting
public boolean isBoosting()Description copied from interface:Member
Returns whether a member is boosting the guild or not.- Specified by:
isBoosting
in interfaceMember
- Returns:
- True, if it is boosting
-
getTimeOutEnd
Description copied from interface:Member
The time this Member will be released from time out.
If this Member is not in time out, this returnsnull
. This may also return dates in the past, in which case the time out has expired.- Specified by:
getTimeOutEnd
in interfaceMember
- Returns:
- The time this Member will be released from time out or
null
if not in time out
-
getVoiceState
Description copied from interface:Member
TheVoiceState
of this Member.
This will be null when theCacheFlag.VOICE_STATE
is disabled manuallyThis can be used to get the Member's VoiceChannel using
GuildVoiceState.getChannel()
.Voice states are only cached while the member is connected to a channel. When the member is disconnected, this either returns null or an empty voice state.
- Specified by:
getVoiceState
in interfaceMember
- Returns:
GuildVoiceState
-
getActivities
Description copied from interface:Member
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!- Specified by:
getActivities
in interfaceMember
- Returns:
- Immutable list of
Activities
for the user
-
getOnlineStatus
Description copied from interface:Member
Returns theOnlineStatus
of the User.
If theOnlineStatus
is unrecognized, will returnUNKNOWN
.This will always return
OnlineStatus.OFFLINE
ifCacheFlag.ONLINE_STATUS
is disabled.- Specified by:
getOnlineStatus
in interfaceMember
- Returns:
- The current
OnlineStatus
of theUser
.
-
getOnlineStatus
Description copied from interface:Member
The platform dependentOnlineStatus
of this member.
Since a user can be connected from multiple different devices such as web and mobile, discord specifies a status for eachClientType
.If a user is not online on the specified type,
OFFLINE
is returned.This requires
CacheFlag.CLIENT_STATUS
to be enabled!- Specified by:
getOnlineStatus
in interfaceMember
- Parameters:
type
- The type of client- Returns:
- The status for that specific client or OFFLINE
-
getActiveClients
Description copied from interface:Member
A Set of all activeClientTypes
of this Member. EveryOnlineStatus
other thanOFFLINE
andUNKNOWN
is interpreted as active. SinceINVISIBLE
is only possible for the SelfUser, other Members will never have ClientTypes show as active when actually beingINVISIBLE
, since they will show asOFFLINE
.
If the Member is currently not active with any Client, this returns an empty Set.
WhenCacheFlag.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 eachClientType
.- Specified by:
getActiveClients
in interfaceMember
- Returns:
- EnumSet of all active
ClientTypes
-
getNickname
Description copied from interface:Member
Returns the current nickname of this Member for the parent Guild.This can be changed using
modifyNickname(Member, String)
.- Specified by:
getNickname
in interfaceMember
- Returns:
- The nickname or null, if no nickname is set.
-
getAvatarId
Description copied from interface:Member
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.- Specified by:
getAvatarId
in interfaceMember
- Returns:
- Possibly-null String containing the
Member
per guild avatar id.
-
getEffectiveName
Description copied from interface:Member
Retrieves the Name displayed in the official Discord Client.- Specified by:
getEffectiveName
in interfaceMember
- Returns:
- The guild nickname of this Member or the
effective user name
if no guild nickname is present.
-
getRoles
Description copied from interface:Member
The roles applied to this Member.
The roles are ordered based on their position. The highest role being at index 0 and the lowest at the last index. PreferMember.getUnsortedRoles()
if the order is not relevant.A Member's roles can be changed using the
Guild.addRoleToMember(UserSnowflake, Role)
,Guild.removeRoleFromMember(UserSnowflake, Role)
, andGuild.modifyMemberRoles(Member, Collection, Collection)
methods inGuild
.The Public Role (
@everyone
) is not included in the returned immutable list of roles
It is implicit that every member holds the Public Role in a Guild thus it is not listed here! -
getUnsortedRoles
Description copied from interface:Member
The roles applied to this Member.
This is an unmodifiable reference to the role set of this member. This set has no defined order, useMember.getRoles()
to get an ordered list.A Member's roles can be changed using the
Guild.addRoleToMember(UserSnowflake, Role)
,Guild.removeRoleFromMember(UserSnowflake, Role)
, andGuild.modifyMemberRoles(Member, Collection, Collection)
methods inGuild
.The Public Role (
@everyone
) is not included in the returned immutable set of roles
It is implicit that every member holds the Public Role in a Guild thus it is not listed here!- Specified by:
getUnsortedRoles
in interfaceMember
- Returns:
- An unmodifiable reference to the Set of
Roles
for this Member. - See Also:
-
getColor
Description copied from interface:Member
TheColor
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. -
getColorRaw
public int getColorRaw()Description copied from interface:Member
The raw RGB value for the color of this member.
Defaulting toRole.DEFAULT_COLOR_RAW
if this member uses the default color (special property, it changes depending on theme used in the client)- Specified by:
getColorRaw
in interfaceMember
- Returns:
- The raw RGB value or the role default
-
getFlagsRaw
public int getFlagsRaw()Description copied from interface:Member
The rawflags
bitset for this member.- Specified by:
getFlagsRaw
in interfaceMember
- Returns:
- The raw flag bitset
-
getPermissions
Description copied from interface:IPermissionHolder
The Guild-Wide Permissions this PermissionHolder holds.
Changes to the returned set do not affect this entity directly.- Specified by:
getPermissions
in interfaceIPermissionHolder
- Returns:
- An EnumSet of Permissions granted to this PermissionHolder.
-
getPermissions
Description copied from interface:IPermissionHolder
The Permissions this PermissionHolder holds in the specifiedGuildChannel
.
Permissions returned by this may be different fromIPermissionHolder.getPermissions()
due to the GuildChannel'sPermissionOverrides
.
Changes to the returned set do not affect this entity directly.- Specified by:
getPermissions
in interfaceIPermissionHolder
- Parameters:
channel
- TheGuildChannel
of which to get Permissions for- Returns:
- Set of Permissions granted to this Permission Holder in the specified channel.
-
getPermissionsExplicit
Description copied from interface:IPermissionHolder
The explicitly granted permissions for this permission holder in the guild.
This disregards owner and administrator privileges. For a role this is identical toIPermissionHolder.getPermissions()
and members have all their roles taken into consideration.
Changes to the returned set do not affect this entity directly.- Specified by:
getPermissionsExplicit
in interfaceIPermissionHolder
- Returns:
- EnumSet of the explicitly granted permissions
-
getPermissionsExplicit
Description copied from interface:IPermissionHolder
The explicitly granted permissions for this permission holder in the guild.
This disregards owner and administrator privileges.
Permissions returned by this may be different fromIPermissionHolder.getPermissionsExplicit()
due to the GuildChannel'sPermissionOverrides
.
Changes to the returned set do not affect this entity directly.- Specified by:
getPermissionsExplicit
in interfaceIPermissionHolder
- Parameters:
channel
- TheGuildChannel
of which to get Permissions for- Returns:
- EnumSet of the explicitly granted permissions in the specified channel
-
hasPermission
Description copied from interface:IPermissionHolder
Checks whether or not this PermissionHolder has the givenPermissions
in the Guild.- Specified by:
hasPermission
in interfaceIPermissionHolder
- Parameters:
permissions
- Permissions to check for.- Returns:
- True, if all of the specified Permissions are granted to this PermissionHolder.
-
hasPermission
Description copied from interface:IPermissionHolder
Checks whether or not this PermissionHolder has the givenPermissions
in the specified GuildChannel.- Specified by:
hasPermission
in interfaceIPermissionHolder
- Parameters:
channel
- TheGuildChannel
in which to check.permissions
- Permissions to check for.- Returns:
- True, if all of the specified Permissions are granted to this PermissionHolder in the provided GuildChannel.
- See Also:
-
canSync
public boolean canSync(@Nonnull IPermissionContainer targetChannel, @Nonnull IPermissionContainer syncSource) Description copied from interface:IPermissionHolder
Whether the permissions of this PermissionHolder are good enough to sync the target channel with the sync source.
This checks what permissions would be changed by the overrides of the sync source and whether the permission holder is able to set them on the target channel.If the permission holder had
Permission.MANAGE_PERMISSIONS
in an override on the target channel orPermission.ADMINISTRATOR
on one of its roles, then it can set any permission on the target channel. Otherwise, the permission holder can only set permissions it also has in the channel.- Specified by:
canSync
in interfaceIPermissionHolder
- Parameters:
targetChannel
- The target channel to checksyncSource
- The sync source, for example the parent category (seeICategorizableChannel.getParentCategory()
)- Returns:
- True, if the channels can be synced
-
canSync
Description copied from interface:IPermissionHolder
Whether the permissions of this PermissionHolder are good enough to sync the target channel with any other channel.
This checks whether the permission holder has local administrator.If the permission holder had
Permission.MANAGE_PERMISSIONS
in an override on the target channel orPermission.ADMINISTRATOR
on one of its roles, then it can set any permission on the target channel.- Specified by:
canSync
in interfaceIPermissionHolder
- Parameters:
channel
- The target channel to check- Returns:
- True, if the channel can be synced
-
canInteract
Description copied from interface:Member
Whether this Member can interact with the provided Member (kick/ban/etc.)- Specified by:
canInteract
in interfaceMember
- Parameters:
member
- The target Member to check- Returns:
- True, if this Member is able to interact with the specified Member
-
canInteract
Description copied from interface:Member
Whether this Member can interact with the providedRole
(kick/ban/move/modify/delete/etc.)If this returns true this member can assign the role to other members.
- Specified by:
canInteract
in interfaceMember
- Parameters:
role
- The target Role to check- Returns:
- True, if this member is able to interact with the specified Role
-
canInteract
Description copied from interface:Member
Whether this Member can interact with the providedRichCustomEmoji
(use in a message)- Specified by:
canInteract
in interfaceMember
- Parameters:
emoji
- The target emoji to check- Returns:
- True, if this Member is able to interact with the specified emoji
-
isOwner
public boolean isOwner()Description copied from interface:Member
Checks whether this member is the owner of its relatedGuild
. -
isPending
public boolean isPending()Description copied from interface:Member
Checks whether this member has passed theGuild's
Membership Screening requirements. -
getIdLong
public long getIdLong()Description copied from interface:ISnowflake
The Snowflake id of this entity. This is unique to every entity and will never change.- Specified by:
getIdLong
in interfaceISnowflake
- Returns:
- Long containing the Id.
-
getAsMention
Description copied from interface:IMentionable
Retrieve a Mention for this Entity. For the publicRole
(@everyone), this will return the literal string"@everyone"
.- Specified by:
getAsMention
in interfaceIMentionable
- Returns:
- A resolvable mention.
-
getDefaultChannel
Description copied from interface:Member
Thedefault channel
for aMember
.
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 hasPermission.VIEW_CHANNEL
permissions. If this requirement doesn't apply for any channel in the guild, this method returnsnull
.- Specified by:
getDefaultChannel
in interfaceMember
- Returns:
- The
channel
representing the default channel for this member or null if no such channel exists.
-
getDefaultAvatarId
Description copied from interface:UserSnowflake
The Discord ID for this user's default avatar image.- Specified by:
getDefaultAvatarId
in interfaceUserSnowflake
- Returns:
- Never-null String containing the user's default avatar id.
-
setNickname
- Specified by:
setNickname
in interfaceMemberMixin<MemberImpl>
-
setAvatarId
- Specified by:
setAvatarId
in interfaceMemberMixin<MemberImpl>
-
setJoinDate
- Specified by:
setJoinDate
in interfaceMemberMixin<MemberImpl>
-
setBoostDate
- Specified by:
setBoostDate
in interfaceMemberMixin<MemberImpl>
-
setTimeOutEnd
- Specified by:
setTimeOutEnd
in interfaceMemberMixin<MemberImpl>
-
setPending
- Specified by:
setPending
in interfaceMemberMixin<MemberImpl>
-
setFlags
- Specified by:
setFlags
in interfaceMemberMixin<MemberImpl>
-
getRoleSet
-
getBoostDateRaw
public long getBoostDateRaw() -
getTimeOutEndRaw
public long getTimeOutEndRaw() -
equals
-
hashCode
public int hashCode() -
toString
-