From 74926368181a62ac6f5e53757495e6801912f4e2 Mon Sep 17 00:00:00 2001 From: jack1142 <6032823+jack1142@users.noreply.github.com> Date: Sun, 12 Apr 2020 00:09:05 +0200 Subject: [PATCH] Fix ignored channels list in `[p]ignore` (#3746) * Fix ignored channels list * Update settings_caches.py * Update core_commands.py --- redbot/core/core_commands.py | 7 ++----- redbot/core/settings_caches.py | 8 ++++++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/redbot/core/core_commands.py b/redbot/core/core_commands.py index a33d3a3ab..8e8661ebe 100644 --- a/redbot/core/core_commands.py +++ b/redbot/core/core_commands.py @@ -2544,17 +2544,14 @@ class Core(commands.Cog, CoreLogic): if channel.category and channel.category not in category_channels: if await self.bot._ignored_cache.get_ignored_channel(channel.category): category_channels.append(channel.category) - continue - else: - continue - if await self.bot._ignored_cache.get_ignored_channel(channel): + if await self.bot._ignored_cache.get_ignored_channel(channel, check_category=False): text_channels.append(channel) cat_str = ( humanize_list([c.name for c in category_channels]) if category_channels else "None" ) chan_str = humanize_list([c.mention for c in text_channels]) if text_channels else "None" - msg = _("Currently ignored categories: {categories}\nChannels:{channels}").format( + msg = _("Currently ignored categories: {categories}\nChannels: {channels}").format( categories=cat_str, channels=chan_str ) return msg diff --git a/redbot/core/settings_caches.py b/redbot/core/settings_caches.py index 07032f406..da2748004 100644 --- a/redbot/core/settings_caches.py +++ b/redbot/core/settings_caches.py @@ -59,11 +59,15 @@ class IgnoreManager: self._cached_channels: Dict[int, bool] = {} self._cached_guilds: Dict[int, bool] = {} - async def get_ignored_channel(self, channel: discord.TextChannel) -> bool: + async def get_ignored_channel( + self, channel: discord.TextChannel, check_category: bool = True + ) -> bool: ret: bool cid: int = channel.id - cat_id: Optional[int] = channel.category.id if channel.category else None + cat_id: Optional[int] = ( + channel.category.id if check_category and channel.category else None + ) if cid in self._cached_channels: chan_ret = self._cached_channels[cid] else: