Skip to content

Commit

Permalink
Fix broken update
Browse files Browse the repository at this point in the history
  • Loading branch information
aigoncharov committed Jul 18, 2024
1 parent dd81cda commit 7aa828f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "telegram-to-rss"
version = "0.2.4"
version = "0.2.5"
description = ""
authors = ["aigoncharov"]
license = "MIT"
Expand Down
14 changes: 11 additions & 3 deletions telegram_to_rss/poll_telegram.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,18 @@ async def update_feed(self, dialog: custom.Dialog):
feed = await Feed.get(id=dialog.id)
last_feed_entry = await FeedEntry.filter(feed=feed).order_by("-date").first()

[_, tg_message_id] = parse_feed_entry_id(last_feed_entry.id)
get_dialog_messages_args = {}
if last_feed_entry:
[_, tg_message_id] = parse_feed_entry_id(last_feed_entry.id)
get_dialog_messages_args["min_message_id"] = tg_message_id
logging.warning(
f"TelegramPoller.update_feed -> feed {feed.name} ({feed.id}) does not have associated feed entries"
)
else:
get_dialog_messages_args["limit"] = self._new_feed_limit

new_dialog_messages = await self._client.get_dialog_messages(
dialog=dialog,
min_message_id=tg_message_id,
dialog=dialog, **get_dialog_messages_args
)

feed_entries = await self._process_new_dialog_messages(
Expand Down

0 comments on commit 7aa828f

Please sign in to comment.