adds the locale property to the user model, which appears not to be specified for botspull/1237/head
@@ -134,5 +134,12 @@ namespace Discord | |||||
/// The type of Nitro subscription the user subscribes to, or null if this value could not be determined. | /// The type of Nitro subscription the user subscribes to, or null if this value could not be determined. | ||||
/// </returns> | /// </returns> | ||||
PremiumType? PremiumType { get; } | PremiumType? PremiumType { get; } | ||||
/// <summary> | |||||
/// The user's chosen language option. | |||||
/// </summary> | |||||
/// <returns> | |||||
/// The value of the user's chosen language option, if provided. | |||||
/// </returns> | |||||
string Locale { get; } | |||||
} | } | ||||
} | } |
@@ -27,5 +27,7 @@ namespace Discord.API | |||||
public Optional<int> Flags { get; set; } | public Optional<int> Flags { get; set; } | ||||
[JsonProperty("premium_type")] | [JsonProperty("premium_type")] | ||||
public Optional<PremiumType> PremiumType { get; set; } | public Optional<PremiumType> PremiumType { get; set; } | ||||
[JsonProperty("locale")] | |||||
public Optional<string> Locale { get; set; } | |||||
} | } | ||||
} | } |
@@ -36,6 +36,8 @@ namespace Discord.Rest | |||||
public int Flags { get; private set; } | public int Flags { get; private set; } | ||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public PremiumType? PremiumType { get; private set; } | public PremiumType? PremiumType { get; private set; } | ||||
/// <inheritdoc /> | |||||
public string Locale { get; private set; } | |||||
internal RestUser(BaseDiscordClient discord, ulong id) | internal RestUser(BaseDiscordClient discord, ulong id) | ||||
: base(discord, id) | : base(discord, id) | ||||
@@ -67,6 +69,8 @@ namespace Discord.Rest | |||||
Flags = model.Flags.Value; | Flags = model.Flags.Value; | ||||
if (model.PremiumType.IsSpecified) | if (model.PremiumType.IsSpecified) | ||||
PremiumType = model.PremiumType.Value; | PremiumType = model.PremiumType.Value; | ||||
if (model.Locale.IsSpecified) | |||||
Locale = model.Locale.Value; | |||||
} | } | ||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
@@ -42,6 +42,8 @@ namespace Discord.WebSocket | |||||
public int Flags { get; internal set; } | public int Flags { get; internal set; } | ||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public PremiumType? PremiumType { get; internal set; } | public PremiumType? PremiumType { get; internal set; } | ||||
/// <inheritdoc /> | |||||
public string Locale { get; internal set; } | |||||
/// <summary> | /// <summary> | ||||
/// Gets mutual guilds shared with this user. | /// Gets mutual guilds shared with this user. | ||||
/// </summary> | /// </summary> | ||||
@@ -89,6 +91,11 @@ namespace Discord.WebSocket | |||||
PremiumType = model.PremiumType.Value; | PremiumType = model.PremiumType.Value; | ||||
hasChanges = true; | hasChanges = true; | ||||
} | } | ||||
if (model.Locale.IsSpecified && model.Locale.Value != Locale) | |||||
{ | |||||
Locale = model.Locale.Value; | |||||
hasChanges = true; | |||||
} | |||||
return hasChanges; | return hasChanges; | ||||
} | } | ||||