Class CurrentUser

  • All Implemented Interfaces:
    ISnowflake

    public class CurrentUser
    extends Object
    implements ISnowflake
    Represents the user this application is running for.
    • Constructor Detail

      • CurrentUser

        public CurrentUser​(String id,
                           String username,
                           String discriminator,
                           String avatar,
                           boolean twoFAEnabled,
                           boolean verified,
                           String email,
                           String locale,
                           int flags)
    • Method Detail

      • getId

        @Nonnull
        public String getId()
        Returns the snowflake, this object is holding.
        Specified by:
        getId in interface ISnowflake
        Returns:
        id snowflake
      • getUsername

        @Nonnull
        public String getUsername()
        Returns the username of the user.
        Returns:
        username
      • getDiscriminator

        @Nonnull
        public String getDiscriminator()
        Returns the discriminator of the user.

        A discriminator is a 4 digit number, appended after the user's name, divided by a "#" from the user name.

        Returns:
        discriminator
      • getAvatar

        @Nullable
        public String getAvatar()
        Returns the user's avatar icon hash
        Returns:
        avatar icon hash
      • getDefaultAvatar

        @Nonnull
        public String getDefaultAvatar()
        Returns the user's default avatar icon hash.
        Returns:
        default avatar icon hash
      • getEffectiveAvatar

        @Nonnull
        public String getEffectiveAvatar()
        Returns the user's effective avatar icon hash, effective meaning currently applied.
        Returns:
        currently applied avatar icon hash
      • isBot

        @Deprecated
        public boolean isBot()
        Deprecated.
        Due to the nature of OAuth2 at this moment, bots are not allowed to use the various urls provided.
        Returns whenever the current user is a bot.
        Returns:
        true if bot, false otherwise
      • isTwoFAEnabled

        public boolean isTwoFAEnabled()
        Returns whenever the current user has 2FA enabled.
        Returns:
        true if 2fa enabled, false otherwise
      • isVerified

        public boolean isVerified()
        Returns if the user has verified his email or not.
        Returns:
        true if verified, false otherwise
      • getEmail

        @Nullable
        public String getEmail()
        Returns the email of the user, if so we have the scope provided.
        Returns:
        email
      • getLocale

        @Nonnull
        public String getLocale()
        Returns the locale, set on the discord client by the user.
        Returns:
        locale
      • getAsMention

        @Nonnull
        public String getAsMention()
        Gets the user as a discord formatted mention.
        Returns:
        mention