feat: ai letter + disabled fl
This commit is contained in:
@@ -3,7 +3,7 @@ from __future__ import annotations
|
||||
import logging
|
||||
|
||||
from app.filters import get_offer_skip_reason
|
||||
from app.state import SentOffersStore
|
||||
from app.state import PublishedOffersStore, SentOffersStore
|
||||
from app.telegram import TelegramPublisher
|
||||
from app.sources.base import OfferSource
|
||||
|
||||
@@ -17,6 +17,7 @@ class OfferProcessingService:
|
||||
sources: list[OfferSource],
|
||||
publisher: TelegramPublisher,
|
||||
sent_offers_store: SentOffersStore,
|
||||
published_offers_store: PublishedOffersStore,
|
||||
include_keywords: list[str],
|
||||
exclude_keywords: list[str],
|
||||
min_price_amount: int | None,
|
||||
@@ -24,6 +25,7 @@ class OfferProcessingService:
|
||||
self._sources = sources
|
||||
self._publisher = publisher
|
||||
self._sent_offers_store = sent_offers_store
|
||||
self._published_offers_store = published_offers_store
|
||||
self._include_keywords = include_keywords
|
||||
self._exclude_keywords = exclude_keywords
|
||||
self._min_price_amount = min_price_amount
|
||||
@@ -66,12 +68,13 @@ class OfferProcessingService:
|
||||
continue
|
||||
|
||||
try:
|
||||
await self._publisher.publish_offer(offer)
|
||||
message = await self._publisher.publish_offer(offer)
|
||||
except Exception:
|
||||
logger.exception("Failed to publish offer %s", offer.dedup_key)
|
||||
continue
|
||||
|
||||
self._sent_offers_store.add(offer.dedup_key)
|
||||
self._published_offers_store.add(message.chat.id, message.message_id, offer)
|
||||
published_count += 1
|
||||
logger.info("Published offer %s", offer.dedup_key)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user