Browse Source

Added nick to PRESENCE_UPDATE

tags/1.0-rc
RogueException 9 years ago
parent
commit
031d178303
3 changed files with 8 additions and 3 deletions
  1. +5
    -2
      src/Discord.Net/API/Common/Presence.cs
  2. +1
    -1
      src/Discord.Net/DiscordSocketClient.cs
  3. +2
    -0
      src/Discord.Net/Entities/Users/GuildUser.cs

+ 5
- 2
src/Discord.Net/API/Common/Presence.cs View File

@@ -8,11 +8,14 @@ namespace Discord.API
public User User { get; set; }
[JsonProperty("guild_id")]
public Optional<ulong> GuildId { get; set; }
[JsonProperty("roles")]
public Optional<ulong[]> Roles { get; set; }
[JsonProperty("status")]
public UserStatus Status { get; set; }
[JsonProperty("game")]
public Game Game { get; set; }

[JsonProperty("roles")]
public Optional<ulong[]> Roles { get; set; }
[JsonProperty("nick")]
public Optional<string> Nick { get; set; }
}
}

+ 1
- 1
src/Discord.Net/DiscordSocketClient.cs View File

@@ -853,7 +853,7 @@ namespace Discord
else
{
guild.AddOrUpdatePresence(data);
if (data.Roles.IsSpecified) //Happens when a user we haven't seen before logs in
if (data.Roles.IsSpecified || data.Nick.IsSpecified) //Happens when a user we haven't seen before logs in
{
CachedGuildUser user = guild.GetUser(data.User.Id);
if (user == null)


+ 2
- 0
src/Discord.Net/Entities/Users/GuildUser.cs View File

@@ -74,6 +74,8 @@ namespace Discord
if (model.Roles.IsSpecified)
UpdateRoles(model.Roles.Value);
if (model.Nick.IsSpecified)
Nickname = model.Nick.Value;
}
public void Update(VoiceStateModel model, UpdateSource source)
{


Loading…
Cancel
Save