fix: Create DM channel with id and author alone (#1850)

* Create DM channel with id and author alone

* Unneeded cast
This commit is contained in:
Paulo
2021-05-24 17:19:11 -03:00
committed by GitHub
parent 75b74e1a3f
commit 95bae786b8
2 changed files with 64 additions and 47 deletions

View File

@@ -49,6 +49,16 @@ namespace Discord.WebSocket
{
Recipient.Update(state, model.Recipients.Value[0]);
}
internal static SocketDMChannel Create(DiscordSocketClient discord, ClientState state, ulong channelId, API.User recipient)
{
var entity = new SocketDMChannel(discord, channelId, discord.GetOrCreateUser(state, recipient));
entity.Update(state, recipient);
return entity;
}
internal void Update(ClientState state, API.User recipient)
{
Recipient.Update(state, recipient);
}
/// <inheritdoc />
public Task CloseAsync(RequestOptions options = null)