Package net.dv8tion.jda.api.managers
Interface AccountManager
-
- All Superinterfaces:
AuditableRestAction<Void>
,Manager<AccountManager>
,RestAction<Void>
public interface AccountManager extends Manager<AccountManager>
Manager providing functionality to update one or more fields for the logged in account.Example
manager.setName("Minn") .setAvatar(null) .queue(); manager.reset(AccountManager.NAME | AccountManager.AVATAR) .setName("DV8FromTheWorld") .setAvatar(icon) .queue();
- See Also:
JDA.getSelfUser()
,SelfUser.getManager()
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description SelfUser
getSelfUser()
TheSelfUser
that will be modified by this AccountManager.AccountManager
reset(long fields)
Resets the fields specified by the provided bit-flag pattern.AccountManager
reset(long... fields)
Resets the fields specified by the provided bit-flag patterns.AccountManager
setAvatar(Icon avatar)
Sets the avatar for the currently logged in accountdefault AccountManager
setAvatar(Icon avatar, String currentPassword)
Deprecated.This is no longer supporteddefault AccountManager
setEmail(String email, String currentPassword)
Deprecated.This is no longer supportedAccountManager
setName(String name)
Sets the username for the currently logged in accountdefault AccountManager
setName(String name, String currentPassword)
Deprecated.This is no longer supporteddefault AccountManager
setPassword(String newPassword, String currentPassword)
Deprecated.This is no longer supported-
Methods inherited from interface net.dv8tion.jda.api.requests.restaction.AuditableRestAction
reason
-
Methods inherited from interface net.dv8tion.jda.api.managers.Manager
deadline, reset, setCheck, timeout
-
Methods inherited from interface net.dv8tion.jda.api.requests.RestAction
addCheck, and, and, complete, complete, completeAfter, delay, delay, delay, delay, flatMap, flatMap, getCheck, getJDA, map, mapToResult, onErrorFlatMap, onErrorFlatMap, onErrorMap, onErrorMap, queue, queue, queue, queueAfter, queueAfter, queueAfter, queueAfter, queueAfter, queueAfter, submit, submit, submitAfter, submitAfter, zip
-
-
-
-
Field Detail
-
NAME
static final long NAME
Used to reset the name field- See Also:
- Constant Field Values
-
AVATAR
static final long AVATAR
Used to reset the avatar field- See Also:
- Constant Field Values
-
-
Method Detail
-
getSelfUser
@Nonnull SelfUser getSelfUser()
TheSelfUser
that will be modified by this AccountManager.
This represents the currently logged in account.- Returns:
- The corresponding SelfUser
-
reset
@Nonnull @CheckReturnValue AccountManager reset(long fields)
Resets the fields specified by the provided bit-flag pattern. You can specify a combination by using a bitwise OR concat of the flag constants.
Example:manager.reset(AccountManager.NAME | AccountManager.AVATAR);
Flag Constants:
- Specified by:
reset
in interfaceManager<AccountManager>
- Parameters:
fields
- Integer value containing the flags to reset.- Returns:
- AccountManager for chaining convenience
-
reset
@Nonnull @CheckReturnValue AccountManager reset(long... fields)
Resets the fields specified by the provided bit-flag patterns. You can specify a combination by using a bitwise OR concat of the flag constants.
Example:manager.reset(AccountManager.NAME, AccountManager.AVATAR);
Flag Constants:
- Specified by:
reset
in interfaceManager<AccountManager>
- Parameters:
fields
- Integer values containing the flags to reset.- Returns:
- AccountManager for chaining convenience
-
setName
@Nonnull @CheckReturnValue AccountManager setName(@Nonnull String name)
Sets the username for the currently logged in account- Parameters:
name
- The new username- Returns:
- AccountManager for chaining convenience
- Throws:
IllegalArgumentException
- If the provided name is:- Equal to
null
- Less than
2
or more than32
characters in length
- Equal to
-
setName
@Deprecated @ForRemoval @DeprecatedSince("4.2.0") @Nonnull @CheckReturnValue default AccountManager setName(@Nonnull String name, @Nullable String currentPassword)
Deprecated.This is no longer supportedSets the username for the currently logged in account- Parameters:
name
- The new usernamecurrentPassword
- The current password for the represented account, this is only required forAccountType.CLIENT
- Returns:
- AccountManager for chaining convenience
- Throws:
IllegalArgumentException
- If this is action is performed on an account with the typeCLIENT
and the provided password isnull
or empty
If the provided name is:- Equal to
null
- Less than 2 or more than 32 characters in length
- Equal to
-
setAvatar
@Nonnull @CheckReturnValue AccountManager setAvatar(@Nullable Icon avatar)
Sets the avatar for the currently logged in account- Parameters:
avatar
- AnIcon
instance representing the new Avatar for the current account,null
to reset the avatar to the default avatar.- Returns:
- AccountManager for chaining convenience
-
setAvatar
@Deprecated @ForRemoval @DeprecatedSince("4.2.0") @Nonnull @CheckReturnValue default AccountManager setAvatar(@Nullable Icon avatar, @Nullable String currentPassword)
Deprecated.This is no longer supportedSets the avatar for the currently logged in account- Parameters:
avatar
- AnIcon
instance representing the new Avatar for the current account,null
to reset the avatar to the default avatar.currentPassword
- The current password for the represented account, this is only required forAccountType.CLIENT
- Returns:
- AccountManager for chaining convenience
- Throws:
IllegalArgumentException
- If the providedcurrentPassword
isnull
or empty and the currently logged in account is fromAccountType.CLIENT
-
setEmail
@Deprecated @ForRemoval @DeprecatedSince("4.2.0") @Nonnull @CheckReturnValue default AccountManager setEmail(@Nonnull String email, @Nonnull String currentPassword)
Deprecated.This is no longer supportedSets the email for the currently logged in client account.- Parameters:
email
- The new emailcurrentPassword
- The valid current password for the represented account- Returns:
- AccountManager for chaining convenience
- Throws:
AccountTypeException
- If the currently logged in account is not fromAccountType.CLIENT
IllegalArgumentException
-- If the provided
currentPassword
or the providedemail
isnull
or empty - If the provided
email
is not valid.
- If the provided
-
setPassword
@Deprecated @ForRemoval @DeprecatedSince("4.2.0") @Nonnull @CheckReturnValue default AccountManager setPassword(@Nonnull String newPassword, @Nonnull String currentPassword)
Deprecated.This is no longer supportedSets the password for the currently logged in client account.
If the new password is equal to the current password this does nothing.- Parameters:
newPassword
- The new password for the currently logged in accountcurrentPassword
- The valid current password for the represented account- Returns:
- AccountManager for chaining convenience
- Throws:
AccountTypeException
- If the currently logged in account is not fromAccountType.CLIENT
IllegalArgumentException
- If any of the provided passwords arenull
or empty
-
-