feature: Add ability to modify the banner for guilds (#1432)

This commit is contained in:
NovusTheory
2019-12-26 17:44:01 -06:00
committed by Christopher F
parent a4846516fb
commit d734ce0a11
3 changed files with 9 additions and 0 deletions

View File

@@ -38,6 +38,10 @@ namespace Discord
/// </summary>
public Optional<Image?> Icon { get; set; }
/// <summary>
/// Gets or sets the banner of the guild.
/// </summary>
public Optional<Image?> Banner { get; set; }
/// <summary>
/// Gets or sets the guild's splash image.
/// </summary>
/// <remarks>

View File

@@ -22,6 +22,8 @@ namespace Discord.API.Rest
public Optional<ulong?> SystemChannelId { get; set; }
[JsonProperty("icon")]
public Optional<Image?> Icon { get; set; }
[JsonProperty("banner")]
public Optional<Image?> Banner { get; set; }
[JsonProperty("splash")]
public Optional<Image?> Splash { get; set; }
[JsonProperty("afk_channel_id")]

View File

@@ -32,6 +32,7 @@ namespace Discord.Rest
Icon = args.Icon.IsSpecified ? args.Icon.Value?.ToModel() : Optional.Create<ImageModel?>(),
Name = args.Name,
Splash = args.Splash.IsSpecified ? args.Splash.Value?.ToModel() : Optional.Create<ImageModel?>(),
Banner = args.Banner.IsSpecified ? args.Banner.Value?.ToModel() : Optional.Create<ImageModel?>(),
VerificationLevel = args.VerificationLevel,
ExplicitContentFilter = args.ExplicitContentFilter,
SystemChannelFlags = args.SystemChannelFlags
@@ -57,6 +58,8 @@ namespace Discord.Rest
else if (args.RegionId.IsSpecified)
apiArgs.RegionId = args.RegionId.Value;
if (!apiArgs.Banner.IsSpecified && guild.BannerId != null)
apiArgs.Banner = new ImageModel(guild.BannerId);
if (!apiArgs.Splash.IsSpecified && guild.SplashId != null)
apiArgs.Splash = new ImageModel(guild.SplashId);
if (!apiArgs.Icon.IsSpecified && guild.IconId != null)