Move guild presence updates to GuildMemberUpdated. Filter duplicate UserUpdated events.

This commit is contained in:
RogueException
2017-04-01 15:05:51 -03:00
parent 004bb4cae0
commit fd72583a75
9 changed files with 82 additions and 58 deletions

View File

@@ -11,12 +11,12 @@ namespace Discord.API
[JsonProperty("nick")]
public Optional<string> Nick { get; set; }
[JsonProperty("roles")]
public ulong[] Roles { get; set; }
public Optional<ulong[]> Roles { get; set; }
[JsonProperty("joined_at")]
public Optional<DateTimeOffset> JoinedAt { get; set; }
[JsonProperty("deaf")]
public bool Deaf { get; set; }
public Optional<bool> Deaf { get; set; }
[JsonProperty("mute")]
public bool Mute { get; set; }
public Optional<bool> Mute { get; set; }
}
}

View File

@@ -50,9 +50,12 @@ namespace Discord.Rest
_joinedAtTicks = model.JoinedAt.Value.UtcTicks;
if (model.Nick.IsSpecified)
Nickname = model.Nick.Value;
IsDeafened = model.Deaf;
IsMuted = model.Mute;
UpdateRoles(model.Roles);
if (model.Deaf.IsSpecified)
IsDeafened = model.Deaf.Value;
if (model.Mute.IsSpecified)
IsMuted = model.Mute.Value;
if (model.Roles.IsSpecified)
UpdateRoles(model.Roles.Value);
}
private void UpdateRoles(ulong[] roleIds)
{