diff --git a/src/main/java/net/dv8tion/jda/api/managers/AccountManager.java b/src/main/java/net/dv8tion/jda/api/managers/AccountManager.java index 079f11ab6c..6c51dd078e 100644 --- a/src/main/java/net/dv8tion/jda/api/managers/AccountManager.java +++ b/src/main/java/net/dv8tion/jda/api/managers/AccountManager.java @@ -50,6 +50,8 @@ public interface AccountManager extends Manager long NAME = 1; /** Used to reset the avatar field */ long AVATAR = 1 << 1; + /** Used to reset the banner field */ + long BANNER = 1 << 2; /** * The {@link net.dv8tion.jda.api.entities.SelfUser SelfUser} that will be @@ -137,4 +139,17 @@ public interface AccountManager extends Manager @Nonnull @CheckReturnValue AccountManager setAvatar(@Nullable Icon avatar); + + /** + * Sets the banner for the currently logged in account + * + * @param banner + * An {@link net.dv8tion.jda.api.entities.Icon Icon} instance representing + * the new banner for the current account, {@code null} to reset the banner to the default banner. + * + * @return AccountManager for chaining convenience + */ + @Nonnull + @CheckReturnValue + AccountManager setBanner(@Nullable Icon banner); } diff --git a/src/main/java/net/dv8tion/jda/internal/managers/AccountManagerImpl.java b/src/main/java/net/dv8tion/jda/internal/managers/AccountManagerImpl.java index 6e62bc1df1..4da6e543d6 100644 --- a/src/main/java/net/dv8tion/jda/internal/managers/AccountManagerImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/managers/AccountManagerImpl.java @@ -35,6 +35,7 @@ public class AccountManagerImpl extends ManagerBase implements A protected String name; protected Icon avatar; + protected Icon banner; /** * Creates a new AccountManager instance @@ -63,6 +64,8 @@ public AccountManagerImpl reset(long fields) super.reset(fields); if ((fields & AVATAR) == AVATAR) avatar = null; + if ((fields & BANNER) == BANNER) + banner = null; return this; } @@ -110,6 +113,16 @@ public AccountManagerImpl setAvatar(Icon avatar) return this; } + @Nonnull + @Override + @CheckReturnValue + public AccountManager setBanner(Icon banner) + { + this.banner = banner; + set |= BANNER; + return this; + } + @Override protected RequestBody finalizeData() { @@ -123,6 +136,8 @@ protected RequestBody finalizeData() body.put("username", name); if (shouldUpdate(AVATAR)) body.put("avatar", avatar == null ? null : avatar.getEncoding()); + if (shouldUpdate(BANNER)) + body.put("banner", banner == null ? null : banner.getEncoding()); reset(); return getRequestBody(body);