Class OAuth2UserImpl
java.lang.Object
com.jagrosh.jdautilities.oauth2.entities.impl.OAuth2UserImpl
- All Implemented Interfaces:
OAuth2User,Formattable,net.dv8tion.jda.api.entities.IMentionable,net.dv8tion.jda.api.entities.ISnowflake
- Author:
- John Grosh ([email protected])
-
Constructor Summary
ConstructorsConstructorDescriptionOAuth2UserImpl(OAuth2Client client, Session session, long id, String name, String discriminator, String avatar, String email, boolean verified, boolean mfaEnabled) -
Method Summary
Modifier and TypeMethodDescriptionbooleanGets the user as a discord formatted mention:<@SNOWFLAKE_ID>Gets the user's avatar ID, ornullif they have not set one.Gets the user's avatar URL, ornullif they have not set one.Gets the underlyingOAuth2Clientthat created this OAuth2User.Gets the user's avatar URL.Gets the user's default avatar ID.Gets the user's discriminator.Gets the user's avatar URL, or theirdefault avatar URLif they do not have a custom avatar set on their account.getEmail()Gets the user's email address that is associated with their Discord account.getId()Gets the user's Snowflake ID as a String.longGets the user's Snowflake ID as along.net.dv8tion.jda.api.entities.UsergetJDAUser(net.dv8tion.jda.api.JDA jda) Gets the correspondingJDA Userfrom the provided instance ofJDA.net.dv8tion.jda.api.entities.UsergetJDAUser(net.dv8tion.jda.api.sharding.ShardManager shardManager) Gets the correspondingJDA Userfrom the providedShardManager.getName()Gets the user's account name.Gets the originatingSessionthat is responsible for this OAuth2User.inthashCode()booleanReturnstrueif this user has multi-factor authentication enabled.booleanReturnstrueif the user's Discord account has been verified via email.toString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface net.dv8tion.jda.api.entities.IMentionable
formatToMethods inherited from interface net.dv8tion.jda.api.entities.ISnowflake
getTimeCreatedMethods inherited from interface com.jagrosh.jdautilities.oauth2.entities.OAuth2User
isBot
-
Constructor Details
-
OAuth2UserImpl
-
-
Method Details
-
getClient
Description copied from interface:OAuth2UserGets the underlyingOAuth2Clientthat created this OAuth2User.- Specified by:
getClientin interfaceOAuth2User- Returns:
- The OAuth2Client that created this OAuth2User.
-
getSession
Description copied from interface:OAuth2UserGets the originatingSessionthat is responsible for this OAuth2User.- Specified by:
getSessionin interfaceOAuth2User- Returns:
- The Session responsible for this OAuth2User.
-
getId
Description copied from interface:OAuth2UserGets the user's Snowflake ID as a String.- Specified by:
getIdin interfacenet.dv8tion.jda.api.entities.ISnowflake- Specified by:
getIdin interfaceOAuth2User- Returns:
- The user's Snowflake ID as a String.
-
getIdLong
public long getIdLong()Description copied from interface:OAuth2UserGets the user's Snowflake ID as along.- Specified by:
getIdLongin interfacenet.dv8tion.jda.api.entities.ISnowflake- Specified by:
getIdLongin interfaceOAuth2User- Returns:
- The user's Snowflake ID as a
long.
-
getName
Description copied from interface:OAuth2UserGets the user's account name.- Specified by:
getNamein interfaceOAuth2User- Returns:
- The user's account name.
-
getEmail
Description copied from interface:OAuth2UserGets the user's email address that is associated with their Discord account.Note that if this user is acquired without the '
email' OAuthScope, this will throw aMissingScopeException.- Specified by:
getEmailin interfaceOAuth2User- Returns:
- The user's email.
-
isVerified
public boolean isVerified()Description copied from interface:OAuth2UserReturnstrueif the user's Discord account has been verified via email.This is required to send messages in guilds where certain moderation levels are used.
- Specified by:
isVerifiedin interfaceOAuth2User- Returns:
trueif the user has verified their account,falseotherwise.
-
isMfaEnabled
public boolean isMfaEnabled()Description copied from interface:OAuth2UserReturnstrueif this user has multi-factor authentication enabled.Some guilds require mfa for administrative actions.
- Specified by:
isMfaEnabledin interfaceOAuth2User- Returns:
trueif the user has mfa enabled,falseotherwise.
-
getDiscriminator
Description copied from interface:OAuth2UserGets the user's discriminator.- Specified by:
getDiscriminatorin interfaceOAuth2User- Returns:
- The user's discriminator.
-
getAvatarId
Description copied from interface:OAuth2UserGets the user's avatar ID, ornullif they have not set one.- Specified by:
getAvatarIdin interfaceOAuth2User- Returns:
- The user's avatar ID, or
nullif they have not set one.
-
getAvatarUrl
Description copied from interface:OAuth2UserGets the user's avatar URL, ornullif they have not set one.- Specified by:
getAvatarUrlin interfaceOAuth2User- Returns:
- The user's avatar URL, or
nullif they have not set one.
-
getDefaultAvatarId
Description copied from interface:OAuth2UserGets the user's avatar URL.- Specified by:
getDefaultAvatarIdin interfaceOAuth2User- Returns:
- The user's avatar URL.
-
getDefaultAvatarUrl
Description copied from interface:OAuth2UserGets the user's default avatar ID.- Specified by:
getDefaultAvatarUrlin interfaceOAuth2User- Returns:
- The user's default avatar ID.
-
getEffectiveAvatarUrl
Description copied from interface:OAuth2UserGets the user's avatar URL, or theirdefault avatar URLif they do not have a custom avatar set on their account.- Specified by:
getEffectiveAvatarUrlin interfaceOAuth2User- Returns:
- The user's effective avatar URL.
-
getAsMention
Description copied from interface:OAuth2UserGets the user as a discord formatted mention:<@SNOWFLAKE_ID>- Specified by:
getAsMentionin interfacenet.dv8tion.jda.api.entities.IMentionable- Specified by:
getAsMentionin interfaceOAuth2User- Returns:
- A discord formatted mention of this user.
-
getJDAUser
public net.dv8tion.jda.api.entities.User getJDAUser(net.dv8tion.jda.api.JDA jda) Description copied from interface:OAuth2UserGets the correspondingJDA Userfrom the provided instance ofJDA.Note that there is no guarantee that this will not return
nullas the instance of JDA may not have access to the User.For sharded bots, use
OAuth2User.getJDAUser(ShardManager).- Specified by:
getJDAUserin interfaceOAuth2User- Parameters:
jda- The instance of JDA to get from.- Returns:
- A JDA User, possibly
null.
-
getJDAUser
public net.dv8tion.jda.api.entities.User getJDAUser(net.dv8tion.jda.api.sharding.ShardManager shardManager) Description copied from interface:OAuth2UserGets the correspondingJDA Userfrom the providedShardManager.Note that there is no guarantee that this will not return
nullas the ShardManager may not have access to the User.For un-sharded bots, use
OAuth2User.getJDAUser(JDA).- Specified by:
getJDAUserin interfaceOAuth2User- Parameters:
shardManager- The ShardManager to get from.- Returns:
- A JDA User, possibly
null.
-
equals
-
hashCode
public int hashCode() -
toString
-