public class User extends Object implements Entity
Constructor and Description |
---|
User(ServiceMediator serviceMediator,
UserBean 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 . |
boolean |
equals(Object obj) |
String |
getAvatarUrl()
Gets the user's effective avatar URL.
|
Optional<String> |
getAvatarUrl(Image.Format format)
Gets the user's avatar URL, if present and in a supported format.
|
DiscordClient |
getClient()
Gets the DiscordClient associated to this object.
|
String |
getDefaultAvatarUrl()
Gets the default avatar URL for this user.
|
String |
getDiscriminator()
Gets the user's 4-digit discord-tag.
|
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.
|
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(ServiceMediator serviceMediator, UserBean data)
User
with an associated ServiceMediator and Discord data.serviceMediator
- The ServiceMediator associated to this object, must be non-null.data
- The raw data as represented by Discord, must be non-null.public final DiscordClient getClient()
DiscordObject
getClient
in interface DiscordObject
public final String getUsername()
public final String 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. Supported format types are GIF
if
animated
, otherwise PNG
or JPEG
.public final String getDefaultAvatarUrl()
public final String getAvatarUrl()
avatar URL
. If the
avatar is animated
, a GIF
is returned; otherwise a
PNG
is returned. The default avatar URL
is returned if no
avatar is set for this user.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 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
.