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
ConstructorDescriptionOAuth2UserImpl
(OAuth2Client client, Session session, long id, String name, String discriminator, String avatar, String email, boolean verified, boolean mfaEnabled) -
Method Summary
Modifier and TypeMethodDescriptionboolean
Gets the user as a discord formatted mention:<@SNOWFLAKE_ID>
Gets the user's avatar ID, ornull
if they have not set one.Gets the user's avatar URL, ornull
if they have not set one.Gets the underlyingOAuth2Client
that 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 URL
if 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.long
Gets the user's Snowflake ID as along
.net.dv8tion.jda.api.entities.User
getJDAUser
(net.dv8tion.jda.api.JDA jda) Gets the correspondingJDA User
from the provided instance ofJDA
.net.dv8tion.jda.api.entities.User
getJDAUser
(net.dv8tion.jda.api.sharding.ShardManager shardManager) Gets the correspondingJDA User
from the providedShardManager
.getName()
Gets the user's account name.Gets the originatingSession
that is responsible for this OAuth2User.int
hashCode()
boolean
Returnstrue
if this user has multi-factor authentication enabled.boolean
Returnstrue
if 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, wait
Methods inherited from interface net.dv8tion.jda.api.entities.IMentionable
formatTo
Methods inherited from interface net.dv8tion.jda.api.entities.ISnowflake
getTimeCreated
Methods inherited from interface com.jagrosh.jdautilities.oauth2.entities.OAuth2User
isBot
-
Constructor Details
-
OAuth2UserImpl
-
-
Method Details
-
getClient
Description copied from interface:OAuth2User
Gets the underlyingOAuth2Client
that created this OAuth2User.- Specified by:
getClient
in interfaceOAuth2User
- Returns:
- The OAuth2Client that created this OAuth2User.
-
getSession
Description copied from interface:OAuth2User
Gets the originatingSession
that is responsible for this OAuth2User.- Specified by:
getSession
in interfaceOAuth2User
- Returns:
- The Session responsible for this OAuth2User.
-
getId
Description copied from interface:OAuth2User
Gets the user's Snowflake ID as a String.- Specified by:
getId
in interfacenet.dv8tion.jda.api.entities.ISnowflake
- Specified by:
getId
in interfaceOAuth2User
- Returns:
- The user's Snowflake ID as a String.
-
getIdLong
public long getIdLong()Description copied from interface:OAuth2User
Gets the user's Snowflake ID as along
.- Specified by:
getIdLong
in interfacenet.dv8tion.jda.api.entities.ISnowflake
- Specified by:
getIdLong
in interfaceOAuth2User
- Returns:
- The user's Snowflake ID as a
long
.
-
getName
Description copied from interface:OAuth2User
Gets the user's account name.- Specified by:
getName
in interfaceOAuth2User
- Returns:
- The user's account name.
-
getEmail
Description copied from interface:OAuth2User
Gets 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:
getEmail
in interfaceOAuth2User
- Returns:
- The user's email.
-
isVerified
public boolean isVerified()Description copied from interface:OAuth2User
Returnstrue
if 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:
isVerified
in interfaceOAuth2User
- Returns:
true
if the user has verified their account,false
otherwise.
-
isMfaEnabled
public boolean isMfaEnabled()Description copied from interface:OAuth2User
Returnstrue
if this user has multi-factor authentication enabled.Some guilds require mfa for administrative actions.
- Specified by:
isMfaEnabled
in interfaceOAuth2User
- Returns:
true
if the user has mfa enabled,false
otherwise.
-
getDiscriminator
Description copied from interface:OAuth2User
Gets the user's discriminator.- Specified by:
getDiscriminator
in interfaceOAuth2User
- Returns:
- The user's discriminator.
-
getAvatarId
Description copied from interface:OAuth2User
Gets the user's avatar ID, ornull
if they have not set one.- Specified by:
getAvatarId
in interfaceOAuth2User
- Returns:
- The user's avatar ID, or
null
if they have not set one.
-
getAvatarUrl
Description copied from interface:OAuth2User
Gets the user's avatar URL, ornull
if they have not set one.- Specified by:
getAvatarUrl
in interfaceOAuth2User
- Returns:
- The user's avatar URL, or
null
if they have not set one.
-
getDefaultAvatarId
Description copied from interface:OAuth2User
Gets the user's avatar URL.- Specified by:
getDefaultAvatarId
in interfaceOAuth2User
- Returns:
- The user's avatar URL.
-
getDefaultAvatarUrl
Description copied from interface:OAuth2User
Gets the user's default avatar ID.- Specified by:
getDefaultAvatarUrl
in interfaceOAuth2User
- Returns:
- The user's default avatar ID.
-
getEffectiveAvatarUrl
Description copied from interface:OAuth2User
Gets the user's avatar URL, or theirdefault avatar URL
if they do not have a custom avatar set on their account.- Specified by:
getEffectiveAvatarUrl
in interfaceOAuth2User
- Returns:
- The user's effective avatar URL.
-
getAsMention
Description copied from interface:OAuth2User
Gets the user as a discord formatted mention:<@SNOWFLAKE_ID>
- Specified by:
getAsMention
in interfacenet.dv8tion.jda.api.entities.IMentionable
- Specified by:
getAsMention
in 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:OAuth2User
Gets the correspondingJDA User
from the provided instance ofJDA
.Note that there is no guarantee that this will not return
null
as the instance of JDA may not have access to the User.For sharded bots, use
OAuth2User.getJDAUser(ShardManager)
.- Specified by:
getJDAUser
in 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:OAuth2User
Gets the correspondingJDA User
from the providedShardManager
.Note that there is no guarantee that this will not return
null
as the ShardManager may not have access to the User.For un-sharded bots, use
OAuth2User.getJDAUser(JDA)
.- Specified by:
getJDAUser
in interfaceOAuth2User
- Parameters:
shardManager
- The ShardManager to get from.- Returns:
- A JDA User, possibly
null
.
-
equals
-
hashCode
public int hashCode() -
toString
-