public class User extends Object implements Entity
Modifier and Type | Class and Description |
---|---|
static class |
User.Flag
Describes the flags of a user.
|
Constructor and Description |
---|
User(GatewayDiscordClient gateway,
discord4j.discordjson.json.UserData data)
Constructs an
User with an associated ServiceMediator and Discord data. |
Modifier and Type | Method and Description |
---|---|
Mono<Member> |
asMember(Snowflake guildId)
Requests to retrieve this user as a
Member . |
Mono<Member> |
asMember(Snowflake guildId,
EntityRetrievalStrategy retrievalStrategy)
Requests to retrieve this user as a
Member , using the given retrieval strategy. |
boolean |
equals(Object obj) |
Mono<Image> |
getAvatar()
Gets the user's effective avatar.
|
Mono<Image> |
getAvatar(Image.Format format)
Gets the user's avatar.
|
String |
getAvatarUrl()
Gets the user's effective avatar URL.
|
Optional<String> |
getAvatarUrl(Image.Format format)
Gets the user's avatar URL, if present.
|
GatewayDiscordClient |
getClient()
Returns the
GatewayDiscordClient that created this object. |
String |
getDefaultAvatarUrl()
Gets the default avatar URL for this user.
|
String |
getDiscriminator()
Gets the user's 4-digit discriminator
The discriminator is unique number to distinct one among all users with the same username.
|
Snowflake |
getId()
Gets the Snowflake that uniquely identifies this entity.
|
String |
getMention()
Gets the raw mention.
|
Mono<PrivateChannel> |
getPrivateChannel()
Requests to retrieve the private channel (DM) to this user.
|
EnumSet<User.Flag> |
getPublicFlags()
Returns the public flags of this
User , describing its features. |
String |
getTag()
Gets the user's username and discriminator separated by a #
This is unique across the discord platform, but may change.
|
String |
getUsername()
Gets the user's username, not unique across the platform.
|
boolean |
hasAnimatedAvatar()
Gets if the user's avatar is animated.
|
int |
hashCode() |
boolean |
isBot()
Gets whether the user is a bot.
|
String |
toString() |
public User(GatewayDiscordClient gateway, discord4j.discordjson.json.UserData data)
User
with an associated ServiceMediator and Discord data.gateway
- The GatewayDiscordClient
associated to this object, must be non-null.data
- The raw data as represented by Discord, must be non-null.public final GatewayDiscordClient getClient()
DiscordObject
GatewayDiscordClient
that created this object. Methods in it are exclusively based on the
entity cache or Store
in use. Refer to calling getClient().rest()
to access a
DiscordClient
that is capable of requesting entities directly from the REST API.getClient
in interface DiscordObject
GatewayDiscordClient
associated to this object.public final String getUsername()
public final String getDiscriminator()
public final String getTag()
getUsername()
#getDiscriminator()
public final boolean hasAnimatedAvatar()
true
if the user's avatar is animated, false
otherwise.public final Optional<String> getAvatarUrl(Image.Format format)
format
- The format for the URL.public final String getAvatarUrl()
public Mono<Image> getAvatar(Image.Format format)
getAvatarUrl(Image.Format)
.public final Mono<Image> getAvatar()
getAvatarUrl()
.public final String getDefaultAvatarUrl()
public boolean isBot()
true
if this user is a bot, false
otherwise.public final String getMention()
public final Snowflake getId()
Entity
public Mono<Member> asMember(Snowflake guildId)
Member
.public Mono<Member> asMember(Snowflake guildId, EntityRetrievalStrategy retrievalStrategy)
Member
, using the given retrieval strategy.public final Mono<PrivateChannel> getPrivateChannel()
Mono
where, upon successful completion, emits the private channel
to
this user. If an error is received, it is emitted through the Mono
.public EnumSet<User.Flag> getPublicFlags()
User
, describing its features.EnumSet
with the public flags of this user.