* Fix #995 ICategoryChannel.CategoryID throws NotSupportedException * Add tests * change run mode of TestChannelCategories * Add throw for GetCategoryAsync * Add xml doc explaining why exception is thrown * Add test coverage for text and voice channel categories * initial implementation of INestedChannel * more implementation of INestedChannel design * Add case in RestChannel Create for Category type * set the CategoryID for RestVoiceChannel * rewrite channel category tests to work with existing pattern * remove outdated todo * Make IVoiceChannel implement INestedChannel * remove redundant interface implementation * Add c#7 feature from feedback * Remove redundant GetCategoryAsync methods from socket entities * Added configureawait to async methods * change signature of interface GetCategoryAsync * Add check for cachemode in rest channel GetCategory * remove redundant IGuildChannel interface from ITextChannel and IVoiceChannel
This commit is contained in:
committed by
Christopher F
parent
4d8764e124
commit
f9cbff5e42
@@ -316,6 +316,16 @@ namespace Discord.Rest
|
||||
return models.Select(x => RestWebhook.Create(client, channel, x))
|
||||
.ToImmutableArray();
|
||||
}
|
||||
// Categories
|
||||
public static async Task<ICategoryChannel> GetCategoryAsync(INestedChannel channel, BaseDiscordClient client, RequestOptions options)
|
||||
{
|
||||
// if no category id specified, return null
|
||||
if (!channel.CategoryId.HasValue)
|
||||
return null;
|
||||
// CategoryId will contain a value here
|
||||
var model = await client.ApiClient.GetChannelAsync(channel.CategoryId.Value, options).ConfigureAwait(false);
|
||||
return RestCategoryChannel.Create(client, model) as ICategoryChannel;
|
||||
}
|
||||
|
||||
//Helpers
|
||||
private static IUser GetAuthor(BaseDiscordClient client, IGuild guild, UserModel model, ulong? webhookId)
|
||||
|
||||
Reference in New Issue
Block a user