Fixed crash, added DM/Group channel helpers

This commit is contained in:
RogueException
2017-02-07 21:10:30 -04:00
parent d9fd0c34e4
commit 0cf5493c61
5 changed files with 49 additions and 3 deletions

View File

@@ -39,8 +39,12 @@ namespace Discord.Rest
public Task<RestChannel> GetChannelAsync(ulong id)
=> ClientHelper.GetChannelAsync(this, id);
/// <inheritdoc />
public Task<IReadOnlyCollection<IPrivateChannel>> GetPrivateChannelsAsync()
public Task<IReadOnlyCollection<IRestPrivateChannel>> GetPrivateChannelsAsync()
=> ClientHelper.GetPrivateChannelsAsync(this);
public Task<IReadOnlyCollection<RestDMChannel>> GetDMChannelsAsync()
=> ClientHelper.GetDMChannelsAsync(this);
public Task<IReadOnlyCollection<RestGroupChannel>> GetGroupChannelsAsync()
=> ClientHelper.GetGroupChannelsAsync(this);
/// <inheritdoc />
public Task<IReadOnlyCollection<RestConnection>> GetConnectionsAsync()
@@ -98,6 +102,20 @@ namespace Discord.Rest
else
return ImmutableArray.Create<IPrivateChannel>();
}
async Task<IReadOnlyCollection<IDMChannel>> IDiscordClient.GetDMChannelsAsync(CacheMode mode)
{
if (mode == CacheMode.AllowDownload)
return await GetDMChannelsAsync().ConfigureAwait(false);
else
return ImmutableArray.Create<IDMChannel>();
}
async Task<IReadOnlyCollection<IGroupChannel>> IDiscordClient.GetGroupChannelsAsync(CacheMode mode)
{
if (mode == CacheMode.AllowDownload)
return await GetGroupChannelsAsync().ConfigureAwait(false);
else
return ImmutableArray.Create<IGroupChannel>();
}
async Task<IReadOnlyCollection<IConnection>> IDiscordClient.GetConnectionsAsync()
=> await GetConnectionsAsync().ConfigureAwait(false);