track blocked items
This commit is contained in:
parent
84e72adcd3
commit
a219c75804
@ -147,16 +147,11 @@ class TaskCog(commands.Cog):
|
|||||||
async def process_article(self, api, session, sub_id: int, filters: list[dict], channels: list[SubChannel], article: Article):
|
async def process_article(self, api, session, sub_id: int, filters: list[dict], channels: list[SubChannel], article: Article):
|
||||||
log.debug("processing article '%s' '%s'", article.guid, article.title)
|
log.debug("processing article '%s' '%s'", article.guid, article.title)
|
||||||
|
|
||||||
for _filter in filters:
|
blocked = any(self.filter_article(_filter, article) for _filter in filters)
|
||||||
if self.filter_article(_filter, article):
|
log.debug("filter result: %s", "blocked" if blocked else "ok")
|
||||||
log.debug("filter matched, skipping article")
|
|
||||||
return
|
|
||||||
|
|
||||||
# if any(self.filter_article(_filter, article) for _filter in filters):
|
|
||||||
# return
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
await api.create_tracked_content(guid=article.guid, title=article.title, url=article.url, subscription=sub_id)
|
await api.create_tracked_content(guid=article.guid, title=article.title, url=article.url, subscription=sub_id, blocked=blocked)
|
||||||
log.debug("successfully tracked %s", article.guid)
|
log.debug("successfully tracked %s", article.guid)
|
||||||
except aiohttp.ClientResponseError as error:
|
except aiohttp.ClientResponseError as error:
|
||||||
log.error(error)
|
log.error(error)
|
||||||
@ -166,6 +161,9 @@ class TaskCog(commands.Cog):
|
|||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if blocked:
|
||||||
|
return
|
||||||
|
|
||||||
log.debug("attempting to send embed to %s channel(s)", len(channels))
|
log.debug("attempting to send embed to %s channel(s)", len(channels))
|
||||||
|
|
||||||
embed = await article.to_embed(session)
|
embed = await article.to_embed(session)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user