Package org.javacord.api
Class AccountUpdater
- java.lang.Object
-
- org.javacord.api.AccountUpdater
-
public class AccountUpdater extends Object
This class can be used to update the connected account (e.g. username or avatar).
-
-
Constructor Summary
Constructors Constructor Description AccountUpdater(DiscordApi api)Creates a new account updater.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AccountUpdatersetAvatar(byte[] avatar)Queues the avatar of the connected account to get updated.AccountUpdatersetAvatar(byte[] avatar, String fileType)Queues the avatar of the connected account to get updated.AccountUpdatersetAvatar(BufferedImage avatar)Queues the avatar of the connected account to get updated.AccountUpdatersetAvatar(BufferedImage avatar, String fileType)Queues the avatar of the connected account to get updated.AccountUpdatersetAvatar(File avatar)Queues the avatar of the connected account to get updated.AccountUpdatersetAvatar(InputStream avatar)Queues the avatar of the connected account to get updated.AccountUpdatersetAvatar(InputStream avatar, String fileType)Queues the avatar of the connected account to get updated.AccountUpdatersetAvatar(URL avatar)Queues the avatar of the connected account to get updated.AccountUpdatersetAvatar(Icon avatar)Queues the avatar of the connected account to get updated.AccountUpdatersetUsername(String username)Queues the username of the connected account to get updated.CompletableFuture<Void>update()Performs the queued updates.
-
-
-
Constructor Detail
-
AccountUpdater
public AccountUpdater(DiscordApi api)
Creates a new account updater.- Parameters:
api- The discord api instance.
-
-
Method Detail
-
setUsername
public AccountUpdater setUsername(String username)
Queues the username of the connected account to get updated.- Parameters:
username- The username to set.- Returns:
- The current instance in order to chain call methods.
-
setAvatar
public AccountUpdater setAvatar(BufferedImage avatar)
Queues the avatar of the connected account to get updated. This method assumes the file type is "png"!- Parameters:
avatar- The avatar to set.- Returns:
- The current instance in order to chain call methods.
-
setAvatar
public AccountUpdater setAvatar(BufferedImage avatar, String fileType)
Queues the avatar of the connected account to get updated.- Parameters:
avatar- The avatar to set.fileType- The type of the avatar, e.g. "png" or "jpg".- Returns:
- The current instance in order to chain call methods.
-
setAvatar
public AccountUpdater setAvatar(File avatar)
Queues the avatar of the connected account to get updated.- Parameters:
avatar- The avatar to set.- Returns:
- The current instance in order to chain call methods.
-
setAvatar
public AccountUpdater setAvatar(Icon avatar)
Queues the avatar of the connected account to get updated.- Parameters:
avatar- The avatar to set.- Returns:
- The current instance in order to chain call methods.
-
setAvatar
public AccountUpdater setAvatar(URL avatar)
Queues the avatar of the connected account to get updated.- Parameters:
avatar- The avatar to set.- Returns:
- The current instance in order to chain call methods.
-
setAvatar
public AccountUpdater setAvatar(byte[] avatar)
Queues the avatar of the connected account to get updated. This method assumes the file type is "png"!- Parameters:
avatar- The avatar to set.- Returns:
- The current instance in order to chain call methods.
-
setAvatar
public AccountUpdater setAvatar(byte[] avatar, String fileType)
Queues the avatar of the connected account to get updated.- Parameters:
avatar- The avatar to set.fileType- The type of the avatar, e.g. "png" or "jpg".- Returns:
- The current instance in order to chain call methods.
-
setAvatar
public AccountUpdater setAvatar(InputStream avatar)
Queues the avatar of the connected account to get updated. This method assumes the file type is "png"!- Parameters:
avatar- The avatar to set.- Returns:
- The current instance in order to chain call methods.
-
setAvatar
public AccountUpdater setAvatar(InputStream avatar, String fileType)
Queues the avatar of the connected account to get updated.- Parameters:
avatar- The avatar to set.fileType- The type of the avatar, e.g. "png" or "jpg".- Returns:
- The current instance in order to chain call methods.
-
update
public CompletableFuture<Void> update()
Performs the queued updates.- Returns:
- A future to check if the update was successful.
-
-