From d0c0a56884c8469bbb643afdc2b3b3421ada61fe Mon Sep 17 00:00:00 2001 From: Mihail Gribkov <61027276+Misha-133@users.noreply.github.com> Date: Fri, 15 Mar 2024 01:30:23 +0300 Subject: [PATCH] [Feature] Support setting banner on bot profiles (#2879) --- src/Discord.Net.Core/Entities/Users/SelfUserProperties.cs | 5 +++++ src/Discord.Net.Rest/API/Rest/ModifyCurrentUserParams.cs | 3 +++ src/Discord.Net.Rest/Entities/Users/UserHelper.cs | 3 ++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Discord.Net.Core/Entities/Users/SelfUserProperties.cs b/src/Discord.Net.Core/Entities/Users/SelfUserProperties.cs index e2ae12ba41..a684af7d99 100644 --- a/src/Discord.Net.Core/Entities/Users/SelfUserProperties.cs +++ b/src/Discord.Net.Core/Entities/Users/SelfUserProperties.cs @@ -14,5 +14,10 @@ public class SelfUserProperties /// Gets or sets the avatar. /// public Optional Avatar { get; set; } + + /// + /// Gets or sets the banner. + /// + public Optional Banner { get; set; } } } diff --git a/src/Discord.Net.Rest/API/Rest/ModifyCurrentUserParams.cs b/src/Discord.Net.Rest/API/Rest/ModifyCurrentUserParams.cs index e28deb32b8..4e1854361c 100644 --- a/src/Discord.Net.Rest/API/Rest/ModifyCurrentUserParams.cs +++ b/src/Discord.Net.Rest/API/Rest/ModifyCurrentUserParams.cs @@ -9,5 +9,8 @@ internal class ModifyCurrentUserParams public Optional Username { get; set; } [JsonProperty("avatar")] public Optional Avatar { get; set; } + + [JsonProperty("banner")] + public Optional Banner { get; set; } } } diff --git a/src/Discord.Net.Rest/Entities/Users/UserHelper.cs b/src/Discord.Net.Rest/Entities/Users/UserHelper.cs index 301bd9b9f1..64607b40d6 100644 --- a/src/Discord.Net.Rest/Entities/Users/UserHelper.cs +++ b/src/Discord.Net.Rest/Entities/Users/UserHelper.cs @@ -17,7 +17,8 @@ public static Task ModifyAsync(ISelfUser user, BaseDiscordClient client, var apiArgs = new API.Rest.ModifyCurrentUserParams { Avatar = args.Avatar.IsSpecified ? args.Avatar.Value?.ToModel() : Optional.Create(), - Username = args.Username + Username = args.Username, + Banner = args.Banner.IsSpecified ? args.Banner.Value?.ToModel() : Optional.Create() }; if (!apiArgs.Avatar.IsSpecified && user.AvatarId != null)