user update fixes
This commit is contained in:
parent
597c350b9c
commit
c81ea9441c
3 changed files with 13 additions and 4 deletions
|
@ -723,6 +723,15 @@ namespace Maki
|
|||
{
|
||||
DiscordMember member = members.Find(x => x.User.Id == presence.User.Id && x.Server.Id == presence.Guild);
|
||||
|
||||
if (!string.IsNullOrEmpty(presence.User.Username))
|
||||
member.User.Username = presence.User.Username;
|
||||
|
||||
if (presence.User.Tag.HasValue)
|
||||
member.User.Tag = presence.User.Tag.Value;
|
||||
|
||||
if (!string.IsNullOrEmpty(presence.User.AvatarHash))
|
||||
member.User.avatarHash = presence.User.AvatarHash;
|
||||
|
||||
member.User.Game = presence.Game.HasValue ? new DiscordGame(presence.Game.Value) : null;
|
||||
|
||||
if (presence.Roles != null)
|
||||
|
|
|
@ -20,11 +20,11 @@ namespace Maki
|
|||
public DiscordUserStatus Status { get; internal set; }
|
||||
public DiscordGame Game { get; internal set; }
|
||||
|
||||
internal string avatarHash;
|
||||
|
||||
public string NameWithTag => $"{Username}#{Tag:0000}";
|
||||
public override string ToString() => $"<@{Id}>";
|
||||
|
||||
private string avatarHash;
|
||||
|
||||
public string Avatar(string ext = @"png", int size = 128) => RestEndpoints.CDN_URL + $@"/avatars/{Id}/{avatarHash}.{ext}?size={size}";
|
||||
|
||||
internal DiscordUser(Discord discord, User user)
|
||||
|
@ -33,7 +33,7 @@ namespace Maki
|
|||
Id = user.Id;
|
||||
Created = Utility.FromDiscordTimeMilliseconds((long) Id >> 22);
|
||||
Username = user.Username;
|
||||
Tag = user.Tag;
|
||||
Tag = user.Tag.Value;
|
||||
IsBot = user.IsBot;
|
||||
HasMFA = user.HasMFA;
|
||||
IsVerified = user.IsVerified;
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace Maki.Structures.Users
|
|||
/// the user's 4-digit discord-tag
|
||||
/// </summary>
|
||||
[JsonProperty("discriminator")]
|
||||
public ushort Tag;
|
||||
public ushort? Tag;
|
||||
|
||||
/// <summary>
|
||||
/// the user's avatar hash
|
||||
|
|
Reference in a new issue