Guild presence should update global. Cleaned up.

This commit is contained in:
RogueException
2017-04-03 20:41:05 -03:00
parent 91b61768f9
commit d7928622f3
3 changed files with 10 additions and 9 deletions

View File

@@ -1,5 +1,6 @@
using System.Diagnostics; using System.Diagnostics;
using Model = Discord.API.User; using Model = Discord.API.User;
using PresenceModel = Discord.API.Presence;
namespace Discord.WebSocket namespace Discord.WebSocket
{ {
@@ -47,6 +48,11 @@ namespace Discord.WebSocket
} }
} }
internal void Update(ClientState state, PresenceModel model)
{
Presence = SocketPresence.Create(model);
}
internal new SocketGlobalUser Clone() => MemberwiseClone() as SocketGlobalUser; internal new SocketGlobalUser Clone() => MemberwiseClone() as SocketGlobalUser;
} }
} }

View File

@@ -99,12 +99,13 @@ namespace Discord.WebSocket
if (model.Roles.IsSpecified) if (model.Roles.IsSpecified)
UpdateRoles(model.Roles.Value); UpdateRoles(model.Roles.Value);
} }
internal override void Update(ClientState state, PresenceModel model)
=> Update(state, model, true);
internal void Update(ClientState state, PresenceModel model, bool updatePresence) internal void Update(ClientState state, PresenceModel model, bool updatePresence)
{ {
if (updatePresence) if (updatePresence)
base.Update(state, model); {
Presence = SocketPresence.Create(model);
GlobalUser.Update(state, model);
}
if (model.Nick.IsSpecified) if (model.Nick.IsSpecified)
Nickname = model.Nick.Value; Nickname = model.Nick.Value;
if (model.Roles.IsSpecified) if (model.Roles.IsSpecified)

View File

@@ -2,7 +2,6 @@
using System; using System;
using System.Threading.Tasks; using System.Threading.Tasks;
using Model = Discord.API.User; using Model = Discord.API.User;
using PresenceModel = Discord.API.Presence;
namespace Discord.WebSocket namespace Discord.WebSocket
{ {
@@ -55,11 +54,6 @@ namespace Discord.WebSocket
} }
return hasChanges; return hasChanges;
} }
internal virtual void Update(ClientState state, PresenceModel model)
{
Presence = SocketPresence.Create(model);
//Update(state, model.User);
}
public Task<RestDMChannel> CreateDMChannelAsync(RequestOptions options = null) public Task<RestDMChannel> CreateDMChannelAsync(RequestOptions options = null)
=> UserHelper.CreateDMChannelAsync(this, Discord, options); => UserHelper.CreateDMChannelAsync(this, Discord, options);