java.util.Formattable
, IFakeable
, IMentionable
, ISnowflake
SelfUser
public interface User extends ISnowflake, IMentionable, IFakeable
Formattable
and can be used with a Formatter
such as used by String.format(String, Object...)
or PrintStream.printf(String, Object...)
.
This will use IMentionable.getAsMention()
rather than Object.toString()
!
Supported Features:
%#s
- results in getName()
#getDiscriminator()
-> Minn#6688
)%20s
- uses at minimum 20 chars;
%-10s
- uses left-justified padding)%.20s
)More information on formatting syntax can be found in the format syntax documentation
!
Modifier and Type | Method | Description |
---|---|---|
java.lang.String |
getAvatarId() |
The Discord Id for this user's avatar image.
|
java.lang.String |
getAvatarUrl() |
The URL for the user's avatar image.
|
java.lang.String |
getDefaultAvatarId() |
The Discord Id for this user's default avatar image.
|
java.lang.String |
getDefaultAvatarUrl() |
The URL for the for the user's default avatar image.
|
java.lang.String |
getDiscriminator() |
The discriminator of the User . |
java.lang.String |
getEffectiveAvatarUrl() |
The URL for the user's avatar image
If they do not have an avatar set, this will return the URL of their
default avatar
|
JDA |
getJDA() |
Returns the
JDA instance of this User |
java.util.List<Guild> |
getMutualGuilds() |
|
java.lang.String |
getName() |
The username of the
User . |
boolean |
hasPrivateChannel() |
Whether or not the currently logged in user and this user have a currently open
PrivateChannel or not. |
boolean |
isBot() |
Returns whether or not the given user is a Bot-Account (special badge in client, some different behaviour)
|
RestAction<PrivateChannel> |
openPrivateChannel() |
Opens a
PrivateChannel with this User. |
formatTo, getAsMention
getCreationTime, getId, getIdLong
java.lang.String getName()
User
. Length is between 2 and 32 characters (inclusive).User
's username.java.lang.String getDiscriminator()
User
. Used to differentiate between users with the same usernames.
User
discriminator.java.lang.String getAvatarId()
User
avatar id.java.lang.String getAvatarUrl()
User
avatar url.java.lang.String getDefaultAvatarId()
User
default avatar id.java.lang.String getDefaultAvatarUrl()
User
default avatar url.java.lang.String getEffectiveAvatarUrl()
User
effective avatar url.boolean hasPrivateChannel()
PrivateChannel
or not.@CheckReturnValue RestAction<PrivateChannel> openPrivateChannel()
PrivateChannel
with this User.
The following ErrorResponses
are possible:
CANNOT_SEND_TO_USER
RestAction
- Type: PrivateChannel
java.lang.UnsupportedOperationException
- If the recipient User is the currently logged in account (represented by SelfUser
)java.lang.IllegalStateException
- If this User is fake
java.util.List<Guild> getMutualGuilds()
Guild
instances that contain this User
within the current JDA
instance.This method is a shortcut for JDA.getMutualGuilds(User)
.
Guilds
that this user is a member of.boolean isBot()