Create DM channel if one does not exist.

This commit is contained in:
AntiTcb
2017-05-16 20:02:32 -04:00
parent 588df7b0c7
commit 6fed78025c

View File

@@ -66,8 +66,8 @@ namespace Discord.WebSocket
internal SocketUser Clone() => MemberwiseClone() as SocketUser;
//IUser
Task<IDMChannel> IUser.GetDMChannelAsync(CacheMode mode, RequestOptions options)
=> Task.FromResult<IDMChannel>(GlobalUser.DMChannel);
async Task<IDMChannel> IUser.GetDMChannelAsync(CacheMode mode, RequestOptions options)
=> await Task.FromResult<IDMChannel>(GlobalUser.DMChannel ?? await CreateDMChannelAsync(options) as IDMChannel);
async Task<IDMChannel> IUser.CreateDMChannelAsync(RequestOptions options)
=> await CreateDMChannelAsync(options).ConfigureAwait(false);
}