Browse Source

Attach/Remove DMChannel to SocketGlobalUser.DMChannel property

tags/1.0
AntiTcb 8 years ago
parent
commit
7db38f32bb
1 changed files with 6 additions and 0 deletions
  1. +6
    -0
      src/Discord.Net.WebSocket/DiscordSocketClient.cs

+ 6
- 0
src/Discord.Net.WebSocket/DiscordSocketClient.cs View File

@@ -1634,6 +1634,9 @@ namespace Discord.WebSocket
{
var channel = SocketChannel.CreatePrivate(this, state, model);
state.AddChannel(channel as SocketChannel);
if (channel is SocketDMChannel dm)
dm.Recipient.GlobalUser.DMChannel = dm;

return channel;
}
internal ISocketPrivateChannel RemovePrivateChannel(ulong id)
@@ -1641,6 +1644,9 @@ namespace Discord.WebSocket
var channel = State.RemoveChannel(id) as ISocketPrivateChannel;
if (channel != null)
{
if (channel is SocketDMChannel dmChannel)
dmChannel.Recipient.GlobalUser.DMChannel = null;

foreach (var recipient in channel.Recipients)
recipient.GlobalUser.RemoveRef(this);
}


Loading…
Cancel
Save