| @@ -61,7 +61,8 @@ namespace Discord | |||||
| private readonly Reference<Server> _server; | private readonly Reference<Server> _server; | ||||
| [JsonIgnore] | [JsonIgnore] | ||||
| public Channel VoiceChannel { get; private set; } | |||||
| public Channel VoiceChannel => _voiceChannel.Value; | |||||
| private Reference<Channel> _voiceChannel; | |||||
| [JsonIgnore] | [JsonIgnore] | ||||
| public IEnumerable<Role> Roles => _roles.Select(x => x.Value); | public IEnumerable<Role> Roles => _roles.Select(x => x.Value); | ||||
| @@ -130,6 +131,8 @@ namespace Discord | |||||
| if (Id == _client.CurrentUserId) | if (Id == _client.CurrentUserId) | ||||
| x.CurrentUser = null; | x.CurrentUser = null; | ||||
| }); | }); | ||||
| _voiceChannel = new Reference<Channel>(x => _client.Channels[x]); | |||||
| Status = UserStatus.Offline; | Status = UserStatus.Offline; | ||||
| _channels = new ConcurrentDictionary<string, Channel>(); | _channels = new ConcurrentDictionary<string, Channel>(); | ||||
| if (serverId != null) | if (serverId != null) | ||||
| @@ -210,16 +213,16 @@ namespace Discord | |||||
| SessionId = model.SessionId; | SessionId = model.SessionId; | ||||
| if (model.Token != null) | if (model.Token != null) | ||||
| Token = model.Token; | Token = model.Token; | ||||
| if (model.ChannelId != null) | |||||
| VoiceChannel = _client.Channels[model.ChannelId]; | |||||
| if (model.IsSelfDeafened != null) | if (model.IsSelfDeafened != null) | ||||
| IsSelfDeafened = model.IsSelfDeafened.Value; | IsSelfDeafened = model.IsSelfDeafened.Value; | ||||
| if (model.IsSelfMuted != null) | if (model.IsSelfMuted != null) | ||||
| IsSelfMuted = model.IsSelfMuted.Value; | IsSelfMuted = model.IsSelfMuted.Value; | ||||
| if (model.IsServerSuppressed != null) | if (model.IsServerSuppressed != null) | ||||
| IsServerSuppressed = model.IsServerSuppressed.Value; | IsServerSuppressed = model.IsServerSuppressed.Value; | ||||
| } | |||||
| _voiceChannel.Id = model.ChannelId; //Can be null | |||||
| } | |||||
| private void UpdateRoles(IEnumerable<Role> roles) | private void UpdateRoles(IEnumerable<Role> roles) | ||||
| { | { | ||||
| if (_server.Id != null) | if (_server.Id != null) | ||||