From 36f49e1d25d17434331762ac27ed6833c56022f7 Mon Sep 17 00:00:00 2001 From: Chris Johnston Date: Wed, 4 Apr 2018 02:38:29 -0700 Subject: [PATCH] Add check for cachemode in rest channel GetCategory --- src/Discord.Net.Rest/Entities/Channels/RestTextChannel.cs | 2 +- src/Discord.Net.Rest/Entities/Channels/RestVoiceChannel.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Discord.Net.Rest/Entities/Channels/RestTextChannel.cs b/src/Discord.Net.Rest/Entities/Channels/RestTextChannel.cs index 61b587cde..9b72fb366 100644 --- a/src/Discord.Net.Rest/Entities/Channels/RestTextChannel.cs +++ b/src/Discord.Net.Rest/Entities/Channels/RestTextChannel.cs @@ -177,7 +177,7 @@ namespace Discord.Rest // INestedChannel async Task INestedChannel.GetCategoryAsync(CacheMode mode, RequestOptions options) { - if (CategoryId.HasValue) + if (CategoryId.HasValue && mode == CacheMode.AllowDownload) return (await Guild.GetChannelAsync(CategoryId.Value, mode, options).ConfigureAwait(false)) as ICategoryChannel; return null; } diff --git a/src/Discord.Net.Rest/Entities/Channels/RestVoiceChannel.cs b/src/Discord.Net.Rest/Entities/Channels/RestVoiceChannel.cs index 342651e87..a2bead45f 100644 --- a/src/Discord.Net.Rest/Entities/Channels/RestVoiceChannel.cs +++ b/src/Discord.Net.Rest/Entities/Channels/RestVoiceChannel.cs @@ -56,7 +56,7 @@ namespace Discord.Rest // INestedChannel async Task INestedChannel.GetCategoryAsync(CacheMode mode, RequestOptions options) { - if (CategoryId.HasValue) + if (CategoryId.HasValue && mode == CacheMode.AllowDownload) return (await Guild.GetChannelAsync(CategoryId.Value, mode, options).ConfigureAwait(false)) as ICategoryChannel; return null; }