| @@ -217,7 +217,7 @@ namespace Discord.WebSocket | |||||
| private readonly AsyncEvent<Func<SocketGroupUser, Task>> _recipientRemovedEvent = new AsyncEvent<Func<SocketGroupUser, Task>>(); | private readonly AsyncEvent<Func<SocketGroupUser, Task>> _recipientRemovedEvent = new AsyncEvent<Func<SocketGroupUser, Task>>(); | ||||
| // relationships | // relationships | ||||
| public event Func<SocketRelationship, SocketRelationship, Task> RelationshipAdd | |||||
| public event Func<SocketRelationship, SocketRelationship, Task> RelationshipAdded | |||||
| { | { | ||||
| add { _relationshipAddedEvent.Add(value); } | add { _relationshipAddedEvent.Add(value); } | ||||
| remove { _relationshipAddedEvent.Remove(value); } | remove { _relationshipAddedEvent.Remove(value); } | ||||
| @@ -1509,7 +1509,7 @@ namespace Discord.WebSocket | |||||
| await _gatewayLogger.DebugAsync("Received Dispatch (RELATIONSHIP_ADD)").ConfigureAwait(false); | await _gatewayLogger.DebugAsync("Received Dispatch (RELATIONSHIP_ADD)").ConfigureAwait(false); | ||||
| var addedModel = (payload as JToken).ToObject<Relationship>(_serializer); | var addedModel = (payload as JToken).ToObject<Relationship>(_serializer); | ||||
| var before = State.GetRelationship(addedModel.Id); | |||||
| var before = State.GetRelationship(addedModel.Id) ?? SocketRelationship.Create(this, State, new Relationship { Id = addedModel.Id, Type = RelationshipType.None, User = addedModel.User }); | |||||
| var after = AddRelationship(addedModel, State); | var after = AddRelationship(addedModel, State); | ||||
| await _relationshipAddedEvent.InvokeAsync(before, after); | await _relationshipAddedEvent.InvokeAsync(before, after); | ||||
| @@ -1,7 +1,9 @@ | |||||
| using Model = Discord.API.Relationship; | |||||
| using System.Diagnostics; | |||||
| using Model = Discord.API.Relationship; | |||||
| namespace Discord.WebSocket | namespace Discord.WebSocket | ||||
| { | { | ||||
| [DebuggerDisplay("{Type} - {User}")] | |||||
| public class SocketRelationship : IRelationship | public class SocketRelationship : IRelationship | ||||
| { | { | ||||
| public RelationshipType Type { get; internal set; } | public RelationshipType Type { get; internal set; } | ||||