Package discord4j.core.object.entity
Class PartialMember
java.lang.Object
discord4j.core.object.entity.User
discord4j.core.object.entity.PartialMember
- All Implemented Interfaces:
DiscordObject
,Entity
- Direct Known Subclasses:
Member
A partial Discord guild member.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Describes the flags of a member in a guild. -
Constructor Summary
ConstructorDescriptionPartialMember
(GatewayDiscordClient gateway, discord4j.discordjson.json.UserData userData, discord4j.discordjson.json.PartialMemberData memberData, long guildId) Constructs aPartialMember
with an associatedGatewayDiscordClient
and Discord data. -
Method Summary
Modifier and TypeMethodDescriptionRequests to add a role to this member.Requests to add a role to this member while optionally specifying the reason.Requests to retrieve the fullMember
instance corresponding to this partial member.discord4j.core.spec.MemberBanQueryMono
ban()
Requests to ban this user.ban
(discord4j.core.spec.BanQuerySpec spec) Requests to ban this user.ban
(Consumer<? super LegacyBanQuerySpec> spec) Deprecated.discord4j.core.spec.GuildMemberEditMono
edit()
Requests to edit this member.edit
(discord4j.core.spec.GuildMemberEditSpec spec) Requests to edit this member.edit
(Consumer<? super LegacyGuildMemberEditSpec> spec) Deprecated.useedit(GuildMemberEditSpec)
oredit()
which offer an immutable approach to build specsRequests to calculate the permissions granted to this member by his roles in the guild.getColor()
Requests to determine theColor
this member would be visually represented in the Discord client.Gets when the user ends their timeout, if present.Gets the name that is displayed in client.Gets the member's effective avatar.final String
Gets the member's effective avatar URL.getFlags()
Returns the flags of thisPartialMember
.getGuild()
Requests to retrieve the guild this user is associated to.getGuild
(EntityRetrievalStrategy retrievalStrategy) Requests to retrieve the guild this user is associated to, using the given retrieval strategy.getGuildAvatar
(Image.Format format) Gets the member's guild avatar.getGuildAvatarUrl
(Image.Format format) Gets the member's guild avatar URL, if present.Gets the ID of the guild this user is associated to.Requests to retrieve the user's highest guild role.getHighestRole
(EntityRetrievalStrategy retrievalStrategy) Requests to retrieve the user's highest guild role, using the given retrieval strategy.Gets when the user joined the guild, if present.discord4j.discordjson.json.PartialMemberData
Gets the data of the member.Gets the user's guild nickname (if one is set).Deprecated.This type of ping has been deprecated in the Discord API.Gets when the user started boosting the server, if present.Requests to retrieve the presence for this user for this guild.Gets the user's guild roles' IDs.getRoles()
Requests to retrieve the user's guild roles.getRoles
(EntityRetrievalStrategy retrievalStrategy) Requests to retrieve the user's guild roles, using the given retrieval strategy.Requests to retrieve this user's voice state for this guild.final boolean
Gets if the member's guild avatar is animated.hasHigherRoles
(Set<Snowflake> otherRoles) Requests to determine if the position of this member's highest role is greater than the highest position of the provided roles.Requests to invite this member to the stage speakers.Requests to determine if this member is higher 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.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.kick()
Requests to kick this member.Requests to kick this member while optionally specifying the reason.Requests to move this member to the stage audience.removeRole
(Snowflake roleId) Requests to remove a role from this member.removeRole
(Snowflake roleId, String reason) Requests to remove a role from this member while optionally specifying the reason.toString()
unban()
Requests to unban this user.Requests to unban this user while optionally specifying the reason.Methods inherited from class discord4j.core.object.entity.User
asMember, asMember, equals, getAccentColor, getAvatar, getAvatar, getAvatarUrl, getAvatarUrl, getBanner, getBanner, getBannerUrl, getBannerUrl, getClient, getDefaultAvatarUrl, getDiscriminator, getGlobalName, getId, getMention, getPrivateChannel, getPublicFlags, getTag, getUserData, getUsername, hasAnimatedAvatar, hasAnimatedBanner, hashCode, isBot
-
Constructor Details
-
PartialMember
public PartialMember(GatewayDiscordClient gateway, discord4j.discordjson.json.UserData userData, discord4j.discordjson.json.PartialMemberData memberData, long guildId) Constructs aPartialMember
with an associatedGatewayDiscordClient
and Discord data.- Parameters:
gateway
- TheGatewayDiscordClient
associated to this object, must be non-null.memberData
- The raw member data as represented by Discord, must be non-null.guildId
- The ID of the guild this user is associated to.
-
-
Method Details
-
getMemberData
public discord4j.discordjson.json.PartialMemberData getMemberData()Gets the data of the member.- Returns:
- The data of the member.
-
asFullMember
Requests to retrieve the fullMember
instance corresponding to this partial member. -
getRoleIds
Gets the user's guild roles' IDs.- Returns:
- The user's guild roles' IDs.
-
getRoles
Requests to retrieve the user's guild roles.The order of items emitted by the returned
Flux
is unspecified. UseOrderUtil.orderRoles(Flux)
to consistently order roles. -
getRoles
Requests to retrieve the user's guild roles, using the given retrieval strategy.The order of items emitted by the returned
Flux
is unspecified. UseOrderUtil.orderRoles(Flux)
to consistently order roles. -
getHighestRole
Requests to retrieve the user'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.
-
getHighestRole
Requests to retrieve the user's highest guild role, using the given retrieval strategy.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.
-
getJoinTime
Gets when the user joined the guild, if present. Can be absent if it's a lurking stage channel member.- Returns:
- When the user joined the guild, if present.
-
getPremiumTime
Gets when the user started boosting the server, if present.- Returns:
- When the user started boosting the server, if present.
-
getCommunicationDisabledUntil
Gets when the user ends their timeout, if present.- Returns:
- When the user ends their timeout in the server, if present.
-
getGuildId
Gets the ID of the guild this user is associated to.- Returns:
- The ID of the guild this user is associated to.
-
getGuild
Requests to retrieve the guild this user is associated to. -
getGuild
Requests to retrieve the guild this user is associated to, using the given retrieval strategy. -
getDisplayName
Gets the name that is displayed in client.- Returns:
- The name that is displayed in client.
-
getNickname
Gets the user's guild nickname (if one is set).- Returns:
- The user's guild nickname (if one is set).
-
getNicknameMention
Deprecated.This type of ping has been deprecated in the Discord API.Gets the raw nickname mention. This is the format utilized to directly mention another user (assuming the user exists in context of the mention).- Returns:
- The raw nickname mention.
-
hasAnimatedGuildAvatar
public final boolean hasAnimatedGuildAvatar()Gets if the member's guild avatar is animated.- Returns:
true
if the user's avatar is animated,false
otherwise.
-
getGuildAvatarUrl
Gets the member's guild avatar URL, if present.- Parameters:
format
- the format for the URL.- Returns:
- The member's guild avatar URL, if present.
-
getEffectiveAvatarUrl
Gets the member's effective avatar URL. If the member does not have a guild avatar, this defaults to the user's global avatar.- Returns:
- The member's effective avatar URL.
-
getGuildAvatar
Gets the member's guild avatar. This is the avatar at the url given bygetGuildAvatarUrl(Image.Format)
. If the member does not have a guild avatar, this method emitsMono.empty()
.- Parameters:
format
- The format for the avatar.- Returns:
- a
Mono
where, upon successful completion, emotes theguild avatar
of the member. If an error is received, it is emitted through theMono
.
-
getEffectiveAvatar
Gets the member's effective avatar. This is the avatar at the url given bygetEffectiveAvatarUrl()
. -
getVoiceState
Requests to retrieve this user's voice state for this guild.- Returns:
- A
Mono
where, upon successful completion, emits avoice state
for this user for this guild. If an error is received, it is emitted through theMono
.
-
getPresence
Requests to retrieve the presence for this user for this guild.Intent.GUILD_PRESENCES
is required to get the presence of the bot, otherwise the emittedMono
will always be empty. -
kick
Requests to kick this member.- Returns:
- A
Mono
where, upon successful completion, emits nothing; indicating the member was kicked. If an error is received, it is emitted through theMono
.
-
kick
Requests to kick this member while optionally specifying the reason.- Parameters:
reason
- The reason, if present.- Returns:
- A
Mono
where, upon successful completion, emits nothing; indicating the member was kicked. If an error is received, it is emitted through theMono
.
-
addRole
Requests to add a role to this member.- Parameters:
roleId
- The ID of the role to add to this member.- Returns:
- A
Mono
where, upon successful completion, emits nothing; indicating the role was added to this member. If an error is received, it is emitted through theMono
.
-
addRole
Requests to add a role to this member while optionally specifying the reason.- Parameters:
roleId
- The ID of the role to add to this member.reason
- The reason, if present.- Returns:
- A
Mono
where, upon successful completion, emits nothing; indicating the role was added to this member. If an error is received, it is emitted through theMono
.
-
removeRole
Requests to remove a role from this member.- Parameters:
roleId
- The ID of the role to remove from this member.- Returns:
- A
Mono
where, upon successful completion, emits nothing; indicating the role was removed from this member. If an error is received, it is emitted through theMono
.
-
removeRole
Requests to remove a role from this member while optionally specifying the reason.- Parameters:
roleId
- The ID of the role to remove from this member.reason
- The reason, if present.- Returns:
- A
Mono
where, upon successful completion, emits nothing; indicating the role was removed from this member. If an error is received, it is emitted through theMono
.
-
getBasePermissions
Requests to calculate the permissions granted to this member by his roles in the guild.- Returns:
- The permissions granted to this member by his roles in the guild.
-
isHigher
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. This is determined by the positions of each of the members' highest roles.- Parameters:
otherMember
- The member to compare in the role hierarchy with this member.- Returns:
- A
Mono
where, upon successful completion, emitstrue
if this member is higher in the role hierarchy than the provided member,false
otherwise. If an error is received, it is emitted through theMono
.
-
isHigher
Requests to determine if this member is higher 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, emitstrue
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 theMono
.
-
hasHigherRoles
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 set of roles to compare in the role hierarchy with this member's roles.- Returns:
- A
Mono
where, upon successful completion, emitstrue
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 theMono
.
-
getColor
Requests to determine theColor
this member would be visually represented in the Discord client.- Returns:
- A
Mono
where, upon successful completion, emits theColor
this member would be visually represented in the Discord client. If an error is received, it is emitted through theMono
.
-
getFlags
Returns the flags of thisPartialMember
.- Returns:
- A
EnumSet
with the flags of this member.
-
ban
Deprecated.useban(BanQuerySpec)
orban()
which offer an immutable approach to build specsRequests to ban this user.- Parameters:
spec
- AConsumer
that provides a "blank"LegacyBanQuerySpec
to be operated on.- Returns:
- A
Mono
where, upon successful completion, emits nothing; indicating this user was banned. If an error is received, it is emitted through theMono
.
-
ban
public discord4j.core.spec.MemberBanQueryMono ban()Requests to ban this user. Properties specifying how to ban this user can be set via thewithXxx
methods of the returnedMemberBanQueryMono
.- Returns:
- A
MemberBanQueryMono
where, upon successful completion, emits nothing; indicating the specified user was banned. If an error is received, it is emitted through theMemberBanQueryMono
.
-
ban
Requests to ban this user.- Parameters:
spec
- an immutable object that specifies how to ban this user- Returns:
- A
Mono
where, upon successful completion, emits nothing; indicating this user was banned. If an error is received, it is emitted through theMono
.
-
unban
Requests to unban this user.- Returns:
- A
Mono
where, upon successful completion, emits nothing; indicating this user was unbanned. If an error is received, it is emitted through theMono
.
-
unban
Requests to unban this user while optionally specifying the reason.- Parameters:
reason
- The reason, if present.- Returns:
- A
Mono
where, upon successful completion, emits nothing; indicating this user was unbanned. If an error is received, it is emitted through theMono
.
-
edit
Deprecated.useedit(GuildMemberEditSpec)
oredit()
which offer an immutable approach to build specsRequests to edit this member.- Parameters:
spec
- AConsumer
that provides a "blank"LegacyGuildMemberEditSpec
to be operated on.- Returns:
- A
Mono
where, upon successful completion, emits the modifiedMember
. If an error is received, it is emitted through theMono
.
-
edit
public discord4j.core.spec.GuildMemberEditMono edit()Requests to edit this member. Properties specifying how to edit this member can be set via thewithXxx
methods of the returnedGuildMemberEditMono
.- Returns:
- A
GuildMemberEditMono
where, upon successful completion, emits the modifiedMember
. If an error is received, it is emitted through theGuildMemberEditMono
.
-
edit
Requests to edit this member. -
inviteToStageSpeakers
Requests to invite this member to the stage speakers. Require this user to be connected to a stage channel.- Returns:
- A
Mono
where, upon successful completion, emits nothing; indicating the member has been invited to the speakers. If an error is received, it is emitted through theMono
.
-
moveToStageAudience
Requests to move this member to the stage audience. Require this user to be connected to a stage channel.- Returns:
- A
Mono
where, upon successful completion, emits nothing; indicating the member has been moved to the audience. If an error is received, it is emitted through theMono
.
-
toString
-
ban(BanQuerySpec)
orban()
which offer an immutable approach to build specs