Fix ignored channels list in [p]ignore (#3746)

* Fix ignored channels list

* Update settings_caches.py

* Update core_commands.py
This commit is contained in:
jack1142 2020-04-12 00:09:05 +02:00 committed by GitHub
parent 36a0eabf4a
commit 7492636818
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 7 deletions

View File

@ -2544,10 +2544,7 @@ 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 = (

View File

@ -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: