@@ -27,6 +27,7 @@ namespace Discord | |||||
public string AvatarUrl => User.AvatarUrl; | public string AvatarUrl => User.AvatarUrl; | ||||
public DateTimeOffset CreatedAt => User.CreatedAt; | public DateTimeOffset CreatedAt => User.CreatedAt; | ||||
public string Discriminator => User.Discriminator; | public string Discriminator => User.Discriminator; | ||||
public ushort DiscriminatorValue => User.DiscriminatorValue; | |||||
public bool IsAttached => User.IsAttached; | public bool IsAttached => User.IsAttached; | ||||
public bool IsBot => User.IsBot; | public bool IsBot => User.IsBot; | ||||
public string Mention => User.Mention; | public string Mention => User.Mention; | ||||
@@ -1,5 +1,3 @@ | |||||
using System.Threading.Tasks; | |||||
namespace Discord | namespace Discord | ||||
{ | { | ||||
public interface IUser : ISnowflakeEntity, IMentionable, IPresence | public interface IUser : ISnowflakeEntity, IMentionable, IPresence | ||||
@@ -8,6 +6,8 @@ namespace Discord | |||||
string AvatarUrl { get; } | string AvatarUrl { get; } | ||||
/// <summary> Gets the per-username unique id for this user. </summary> | /// <summary> Gets the per-username unique id for this user. </summary> | ||||
string Discriminator { get; } | string Discriminator { get; } | ||||
/// <summary> Gets the per-username unique id for this user. </summary> | |||||
ushort DiscriminatorValue { get; } | |||||
/// <summary> Returns true if this user is a bot account. </summary> | /// <summary> Returns true if this user is a bot account. </summary> | ||||
bool IsBot { get; } | bool IsBot { get; } | ||||
/// <summary> Gets the username for this user. </summary> | /// <summary> Gets the username for this user. </summary> | ||||
@@ -8,15 +8,15 @@ namespace Discord | |||||
internal class User : SnowflakeEntity, IUser | internal class User : SnowflakeEntity, IUser | ||||
{ | { | ||||
private string _avatarId; | private string _avatarId; | ||||
private ushort _discriminator; | |||||
public bool IsBot { get; private set; } | public bool IsBot { get; private set; } | ||||
public string Username { get; private set; } | public string Username { get; private set; } | ||||
public ushort DiscriminatorValue { get; private set; } | |||||
public override DiscordClient Discord { get { throw new NotSupportedException(); } } | public override DiscordClient Discord { get { throw new NotSupportedException(); } } | ||||
public string AvatarUrl => API.CDN.GetUserAvatarUrl(Id, _avatarId); | public string AvatarUrl => API.CDN.GetUserAvatarUrl(Id, _avatarId); | ||||
public string Discriminator => _discriminator.ToString("D4"); | |||||
public string Discriminator => DiscriminatorValue.ToString("D4"); | |||||
public string Mention => MentionUtils.Mention(this, false); | public string Mention => MentionUtils.Mention(this, false); | ||||
public string NicknameMention => MentionUtils.Mention(this, true); | public string NicknameMention => MentionUtils.Mention(this, true); | ||||
public virtual Game Game => null; | public virtual Game Game => null; | ||||
@@ -32,7 +32,7 @@ namespace Discord | |||||
if (source == UpdateSource.Rest && IsAttached) return; | if (source == UpdateSource.Rest && IsAttached) return; | ||||
_avatarId = model.Avatar; | _avatarId = model.Avatar; | ||||
_discriminator = ushort.Parse(model.Discriminator); | |||||
DiscriminatorValue = ushort.Parse(model.Discriminator); | |||||
IsBot = model.Bot; | IsBot = model.Bot; | ||||
Username = model.Username; | Username = model.Username; | ||||
} | } | ||||
@@ -16,6 +16,7 @@ namespace Discord | |||||
public string AvatarUrl => User.AvatarUrl; | public string AvatarUrl => User.AvatarUrl; | ||||
public DateTimeOffset CreatedAt => User.CreatedAt; | public DateTimeOffset CreatedAt => User.CreatedAt; | ||||
public string Discriminator => User.Discriminator; | public string Discriminator => User.Discriminator; | ||||
public ushort DiscriminatorValue => User.DiscriminatorValue; | |||||
public bool IsAttached => User.IsAttached; | public bool IsAttached => User.IsAttached; | ||||
public bool IsBot => User.IsBot; | public bool IsBot => User.IsBot; | ||||
public string Mention => User.Mention; | public string Mention => User.Mention; | ||||