Merge pull request #656 from AntiTcb/fix/GetDMChannelAsync

Remove IUser.CreateDMChannelAsync / Fix SocketGlobalUser.DMChannel
This commit is contained in:
Christopher F
2017-06-16 21:22:56 -04:00
committed by GitHub
7 changed files with 19 additions and 27 deletions

View File

@@ -54,7 +54,7 @@ namespace Discord.Rest
Update(model);
}
public Task<RestDMChannel> CreateDMChannelAsync(RequestOptions options = null)
public Task<RestDMChannel> GetOrCreateDMChannelAsync(RequestOptions options = null)
=> UserHelper.CreateDMChannelAsync(this, Discord, options);
public string GetAvatarUrl(ImageFormat format = ImageFormat.Auto, ushort size = 128)
@@ -64,9 +64,7 @@ namespace Discord.Rest
private string DebuggerDisplay => $"{Username}#{Discriminator} ({Id}{(IsBot ? ", Bot" : "")})";
//IUser
Task<IDMChannel> IUser.GetDMChannelAsync(CacheMode mode, RequestOptions options)
=> Task.FromResult<IDMChannel>(null);
async Task<IDMChannel> IUser.CreateDMChannelAsync(RequestOptions options)
=> await CreateDMChannelAsync(options).ConfigureAwait(false);
async Task<IDMChannel> IUser.GetOrCreateDMChannelAsync(RequestOptions options)
=> await GetOrCreateDMChannelAsync(options);
}
}