From 6fed78025c8c2cfe76917cd3078f9e5312fb1b53 Mon Sep 17 00:00:00 2001 From: AntiTcb Date: Tue, 16 May 2017 20:02:32 -0400 Subject: [PATCH] Create DM channel if one does not exist. --- src/Discord.Net.WebSocket/Entities/Users/SocketUser.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Discord.Net.WebSocket/Entities/Users/SocketUser.cs b/src/Discord.Net.WebSocket/Entities/Users/SocketUser.cs index 1b599bf7e..7575309cb 100644 --- a/src/Discord.Net.WebSocket/Entities/Users/SocketUser.cs +++ b/src/Discord.Net.WebSocket/Entities/Users/SocketUser.cs @@ -66,8 +66,8 @@ namespace Discord.WebSocket internal SocketUser Clone() => MemberwiseClone() as SocketUser; //IUser - Task IUser.GetDMChannelAsync(CacheMode mode, RequestOptions options) - => Task.FromResult(GlobalUser.DMChannel); + async Task IUser.GetDMChannelAsync(CacheMode mode, RequestOptions options) + => await Task.FromResult(GlobalUser.DMChannel ?? await CreateDMChannelAsync(options) as IDMChannel); async Task IUser.CreateDMChannelAsync(RequestOptions options) => await CreateDMChannelAsync(options).ConfigureAwait(false); }