Browse Source

Don't add private channels for dead DMs (if a user has been deleted, the channel shows up as having no recipients).

pull/2516/head
Cool-Man 2 years ago
parent
commit
726ef5fe65
1 changed files with 4 additions and 0 deletions
  1. +4
    -0
      src/Discord.Net.WebSocket/DiscordSocketClient.cs

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

@@ -3006,6 +3006,10 @@ namespace Discord.WebSocket
/// <exception cref="InvalidOperationException">Unexpected channel type is created.</exception>
internal ISocketPrivateChannel AddPrivateChannel(API.Channel model, ClientState state)
{
// don't add dead DMs
if (! (model.Recipients.GetValueOrDefault()?.Any() ?? false))
return null;

var channel = SocketChannel.CreatePrivate(this, state, model);
state.AddChannel(channel as SocketChannel);
return channel;


Loading…
Cancel
Save