diff --git a/src/Discord.Net.Core/Entities/Users/ISelfUser.cs b/src/Discord.Net.Core/Entities/Users/ISelfUser.cs index c1d7874eb..04c655212 100644 --- a/src/Discord.Net.Core/Entities/Users/ISelfUser.cs +++ b/src/Discord.Net.Core/Entities/Users/ISelfUser.cs @@ -26,6 +26,34 @@ namespace Discord /// true if this user has enabled multi-factor authentication on their account; false if not. /// bool IsMfaEnabled { get; } + /// + /// Gets the flags that are applied to a user's account. + /// + /// + /// This value is determined by bitwise OR-ing values together. + /// + /// + /// The value of flags for this user. + /// + UserProperties Flags { get; } + /// + /// Gets the type of Nitro subscription that is active on this user's account. + /// + /// + /// This information may only be available with the identify OAuth scope. + /// + /// + /// The type of Nitro subscription the user subscribes to, if any. + /// + PremiumType PremiumType { get; } + /// + /// Gets the user's chosen language option. + /// + /// + /// The IETF language tag of the user's chosen region, if provided. + /// For example, a locale of "English, US" is "en-US", "Chinese (Taiwan)" is "zh-TW", etc. + /// + string Locale { get; } /// /// Modifies the user's properties. diff --git a/src/Discord.Net.Core/Entities/Users/IUser.cs b/src/Discord.Net.Core/Entities/Users/IUser.cs index 99f709717..5d7d0a0b0 100644 --- a/src/Discord.Net.Core/Entities/Users/IUser.cs +++ b/src/Discord.Net.Core/Entities/Users/IUser.cs @@ -112,34 +112,5 @@ namespace Discord /// contains the DM channel associated with this user. /// Task GetOrCreateDMChannelAsync(RequestOptions options = null); - /// - /// Gets the flags that are applied to a user's account. - /// - /// - /// This value is determined by bitwise OR-ing values together. - /// - /// - /// The value of flags for this user. - /// - UserProperties Flags { get; } - /// - /// Gets the type of Nitro subscription that is active on this user's account. - /// - /// - /// This information may only be available with the identify OAuth scope, - /// meaning that users and bots will not have access to this information. - /// - /// - /// The type of Nitro subscription the user subscribes to, or null if this value could not be determined. - /// - PremiumType? PremiumType { get; } - /// - /// Gets the user's chosen language option. - /// - /// - /// The IETF language tag of the user's chosen region, if provided. - /// For example, a locale of "English, US" is "en-US", "Chinese (Taiwan)" is "zh-TW", etc. - /// - string Locale { get; } } } diff --git a/src/Discord.Net.Rest/API/Common/User.cs b/src/Discord.Net.Rest/API/Common/User.cs index e1a5d2915..2eff3753d 100644 --- a/src/Discord.Net.Rest/API/Common/User.cs +++ b/src/Discord.Net.Rest/API/Common/User.cs @@ -24,7 +24,7 @@ namespace Discord.API [JsonProperty("mfa_enabled")] public Optional MfaEnabled { get; set; } [JsonProperty("flags")] - public Optional Flags { get; set; } + public Optional Flags { get; set; } [JsonProperty("premium_type")] public Optional PremiumType { get; set; } [JsonProperty("locale")] diff --git a/src/Discord.Net.Rest/Entities/Users/RestSelfUser.cs b/src/Discord.Net.Rest/Entities/Users/RestSelfUser.cs index 7f3a3faa8..b5ef01c53 100644 --- a/src/Discord.Net.Rest/Entities/Users/RestSelfUser.cs +++ b/src/Discord.Net.Rest/Entities/Users/RestSelfUser.cs @@ -17,6 +17,12 @@ namespace Discord.Rest public bool IsVerified { get; private set; } /// public bool IsMfaEnabled { get; private set; } + /// + public UserProperties Flags { get; private set; } + /// + public PremiumType PremiumType { get; private set; } + /// + public string Locale { get; private set; } internal RestSelfUser(BaseDiscordClient discord, ulong id) : base(discord, id) @@ -39,6 +45,12 @@ namespace Discord.Rest IsVerified = model.Verified.Value; if (model.MfaEnabled.IsSpecified) IsMfaEnabled = model.MfaEnabled.Value; + if (model.Flags.IsSpecified) + Flags = (UserProperties)model.Flags.Value; + if (model.PremiumType.IsSpecified) + PremiumType = model.PremiumType.Value; + if (model.Locale.IsSpecified) + Locale = model.Locale.Value; } /// diff --git a/src/Discord.Net.Rest/Entities/Users/RestUser.cs b/src/Discord.Net.Rest/Entities/Users/RestUser.cs index ffcd67681..6af5b5c95 100644 --- a/src/Discord.Net.Rest/Entities/Users/RestUser.cs +++ b/src/Discord.Net.Rest/Entities/Users/RestUser.cs @@ -32,12 +32,6 @@ namespace Discord.Rest public virtual UserStatus Status => UserStatus.Offline; /// public virtual bool IsWebhook => false; - /// - public UserProperties Flags { get; private set; } - /// - public PremiumType? PremiumType { get; private set; } - /// - public string Locale { get; private set; } internal RestUser(BaseDiscordClient discord, ulong id) : base(discord, id) @@ -65,12 +59,6 @@ namespace Discord.Rest IsBot = model.Bot.Value; if (model.Username.IsSpecified) Username = model.Username.Value; - if (model.Flags.IsSpecified) - Flags = (UserProperties) model.Flags.Value; - if (model.PremiumType.IsSpecified) - PremiumType = model.PremiumType.Value; - if (model.Locale.IsSpecified) - Locale = model.Locale.Value; } /// diff --git a/src/Discord.Net.WebSocket/Entities/Users/SocketSelfUser.cs b/src/Discord.Net.WebSocket/Entities/Users/SocketSelfUser.cs index ae705109c..7b11257a3 100644 --- a/src/Discord.Net.WebSocket/Entities/Users/SocketSelfUser.cs +++ b/src/Discord.Net.WebSocket/Entities/Users/SocketSelfUser.cs @@ -30,6 +30,12 @@ namespace Discord.WebSocket public override string AvatarId { get { return GlobalUser.AvatarId; } internal set { GlobalUser.AvatarId = value; } } /// internal override SocketPresence Presence { get { return GlobalUser.Presence; } set { GlobalUser.Presence = value; } } + /// + public UserProperties Flags { get; internal set; } + /// + public PremiumType PremiumType { get; internal set; } + /// + public string Locale { get; internal set; } /// public override bool IsWebhook => false; @@ -63,6 +69,21 @@ namespace Discord.WebSocket IsMfaEnabled = model.MfaEnabled.Value; hasGlobalChanges = true; } + if (model.Flags.IsSpecified && model.Flags.Value != Flags) + { + Flags = (UserProperties)model.Flags.Value; + hasGlobalChanges = true; + } + if (model.PremiumType.IsSpecified && model.PremiumType.Value != PremiumType) + { + PremiumType = model.PremiumType.Value; + hasGlobalChanges = true; + } + if (model.Locale.IsSpecified && model.Locale.Value != Locale) + { + Locale = model.Locale.Value; + hasGlobalChanges = true; + } return hasGlobalChanges; } diff --git a/src/Discord.Net.WebSocket/Entities/Users/SocketUser.cs b/src/Discord.Net.WebSocket/Entities/Users/SocketUser.cs index 818c8f269..4832e7311 100644 --- a/src/Discord.Net.WebSocket/Entities/Users/SocketUser.cs +++ b/src/Discord.Net.WebSocket/Entities/Users/SocketUser.cs @@ -38,12 +38,6 @@ namespace Discord.WebSocket public IActivity Activity => Presence.Activity; /// public UserStatus Status => Presence.Status; - /// - public UserProperties Flags { get; internal set; } - /// - public PremiumType? PremiumType { get; internal set; } - /// - public string Locale { get; internal set; } /// /// Gets mutual guilds shared with this user. /// @@ -81,21 +75,6 @@ namespace Discord.WebSocket Username = model.Username.Value; hasChanges = true; } - if (model.Flags.IsSpecified && model.Flags.Value != (int) Flags) - { - Flags = (UserProperties) model.Flags.Value; - hasChanges = true; - } - if (model.PremiumType.IsSpecified && model.PremiumType.Value != PremiumType) - { - PremiumType = model.PremiumType.Value; - hasChanges = true; - } - if (model.Locale.IsSpecified && model.Locale.Value != Locale) - { - Locale = model.Locale.Value; - hasChanges = true; - } return hasChanges; }