@@ -56,6 +56,9 @@ namespace Discord | |||||
/// <summary> | /// <summary> | ||||
/// Gets the guild this invite is linked to. | /// Gets the guild this invite is linked to. | ||||
/// </summary> | /// </summary> | ||||
/// <remarks> | |||||
/// Guild might have empty properties due to API not returning full guild object. | |||||
/// </remarks> | |||||
/// <returns> | /// <returns> | ||||
/// A guild object representing the guild that the invite points to. | /// A guild object representing the guild that the invite points to. | ||||
/// </returns> | /// </returns> | ||||
@@ -66,7 +66,7 @@ namespace Discord.API | |||||
[JsonProperty("premium_subscription_count")] | [JsonProperty("premium_subscription_count")] | ||||
public int? PremiumSubscriptionCount { get; set; } | public int? PremiumSubscriptionCount { get; set; } | ||||
[JsonProperty("preferred_locale")] | [JsonProperty("preferred_locale")] | ||||
public string PreferredLocale { get; set; } | |||||
public Optional<string> PreferredLocale { get; set; } | |||||
[JsonProperty("public_updates_channel_id")] | [JsonProperty("public_updates_channel_id")] | ||||
public ulong? PublicUpdatesChannelId { get; set; } | public ulong? PublicUpdatesChannelId { get; set; } | ||||
[JsonProperty("max_video_channel_users")] | [JsonProperty("max_video_channel_users")] | ||||
@@ -7,7 +7,7 @@ namespace Discord.API | |||||
[JsonProperty("code")] | [JsonProperty("code")] | ||||
public string Code { get; set; } | public string Code { get; set; } | ||||
[JsonProperty("guild")] | [JsonProperty("guild")] | ||||
public Optional<InviteGuild> Guild { get; set; } | |||||
public Optional<Guild> Guild { get; set; } | |||||
[JsonProperty("channel")] | [JsonProperty("channel")] | ||||
public InviteChannel Channel { get; set; } | public InviteChannel Channel { get; set; } | ||||
[JsonProperty("inviter")] | [JsonProperty("inviter")] | ||||
@@ -1,47 +0,0 @@ | |||||
using Newtonsoft.Json; | |||||
using System.Collections.Generic; | |||||
namespace Discord.API | |||||
{ | |||||
internal class InviteGuild | |||||
{ | |||||
[JsonProperty("id")] | |||||
public ulong Id { get; set; } | |||||
[JsonProperty("name")] | |||||
public string Name { get; set; } | |||||
[JsonProperty("splash")] | |||||
public Optional<string> Splash { get; set; } | |||||
[JsonProperty("banner")] | |||||
public Optional<string> BannerHash { get; set; } | |||||
[JsonProperty("description")] | |||||
public Optional<string> Description { get; set; } | |||||
[JsonProperty("icon")] | |||||
public Optional<string> IconHash { get; set; } | |||||
[JsonProperty("features")] | |||||
public GuildFeatures Features { get; set; } | |||||
[JsonProperty("verification_level")] | |||||
public VerificationLevel VerificationLevel { get; set; } | |||||
[JsonProperty("vanity_url_code")] | |||||
public Optional<string> VanityUrlCode { get; set; } | |||||
[JsonProperty("premium_subscription_count")] | |||||
public Optional<int> PremiumSubscriptionCount { get; set; } | |||||
[JsonProperty("nsfw")] | |||||
public Optional<bool?> Nsfw { get; set; } | |||||
[JsonProperty("nsfw_level")] | |||||
public NsfwLevel NsfwLevel { get; set; } | |||||
[JsonProperty("welcome_screen")] | |||||
public Optional<WelcomeScreen> WelcomeScreen { get; set; } | |||||
} | |||||
} |
@@ -57,7 +57,7 @@ namespace Discord.Rest | |||||
{ | { | ||||
var model = await client.ApiClient.GetInviteAsync(inviteId, options).ConfigureAwait(false); | var model = await client.ApiClient.GetInviteAsync(inviteId, options).ConfigureAwait(false); | ||||
if (model != null) | if (model != null) | ||||
return RestInviteMetadata.Create(client, null, null, model); | |||||
return RestInviteMetadata.Create(client, RestGuild.Create(client, model.Guild.IsSpecified ? model.Guild.Value : null), null, model); | |||||
return null; | return null; | ||||
} | } | ||||
@@ -181,8 +181,8 @@ namespace Discord.Rest | |||||
MaxMembers = model.MaxMembers.Value; | MaxMembers = model.MaxMembers.Value; | ||||
if (model.MaxVideoChannelUsers.IsSpecified) | if (model.MaxVideoChannelUsers.IsSpecified) | ||||
MaxVideoChannelUsers = model.MaxVideoChannelUsers.Value; | MaxVideoChannelUsers = model.MaxVideoChannelUsers.Value; | ||||
PreferredLocale = model.PreferredLocale; | |||||
PreferredCulture = new CultureInfo(PreferredLocale); | |||||
PreferredLocale = model.PreferredLocale.IsSpecified ? model.PreferredLocale.Value : null; | |||||
PreferredCulture = model.PreferredLocale.IsSpecified ? new CultureInfo(PreferredLocale) : null; | |||||
if (model.ApproximateMemberCount.IsSpecified) | if (model.ApproximateMemberCount.IsSpecified) | ||||
ApproximateMemberCount = model.ApproximateMemberCount.Value; | ApproximateMemberCount = model.ApproximateMemberCount.Value; | ||||
if (model.ApproximatePresenceCount.IsSpecified) | if (model.ApproximatePresenceCount.IsSpecified) | ||||
@@ -515,7 +515,7 @@ namespace Discord.WebSocket | |||||
MaxMembers = model.MaxMembers.Value; | MaxMembers = model.MaxMembers.Value; | ||||
if (model.MaxVideoChannelUsers.IsSpecified) | if (model.MaxVideoChannelUsers.IsSpecified) | ||||
MaxVideoChannelUsers = model.MaxVideoChannelUsers.Value; | MaxVideoChannelUsers = model.MaxVideoChannelUsers.Value; | ||||
PreferredLocale = model.PreferredLocale; | |||||
PreferredLocale = model.PreferredLocale.IsSpecified ? model.PreferredLocale.Value : null; | |||||
PreferredCulture = PreferredLocale == null ? null : new CultureInfo(PreferredLocale); | PreferredCulture = PreferredLocale == null ? null : new CultureInfo(PreferredLocale); | ||||
if (model.IsBoostProgressBarEnabled.IsSpecified) | if (model.IsBoostProgressBarEnabled.IsSpecified) | ||||
IsBoostProgressBarEnabled = model.IsBoostProgressBarEnabled.Value; | IsBoostProgressBarEnabled = model.IsBoostProgressBarEnabled.Value; | ||||