fix: detect manually marked unread chats in list_chats
Previously list_chats only checked dialog.unread_count, missing chats that were manually marked as unread via Telegram's "mark as unread" feature. Now also checks dialog.dialog.unread_mark flag: - unread_count > 0: shows "Unread: N" - unread_mark = True: shows "Unread: marked" This matches the behavior of Telegram's "Unread" folder filter. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
4b077c708e
commit
6b1f4cda85
1 changed files with 12 additions and 2 deletions
14
main.py
14
main.py
|
|
@ -940,8 +940,18 @@ async def list_chats(chat_type: str = None, limit: int = 20) -> str:
|
||||||
chat_info += f", Username: @{entity.username}"
|
chat_info += f", Username: @{entity.username}"
|
||||||
|
|
||||||
# Add unread count if available
|
# Add unread count if available
|
||||||
if hasattr(dialog, "unread_count") and dialog.unread_count > 0:
|
unread_count = getattr(dialog, "unread_count", 0)
|
||||||
chat_info += f", Unread: {dialog.unread_count}"
|
# Also check unread_mark (manual "mark as unread" flag)
|
||||||
|
unread_mark = (
|
||||||
|
getattr(dialog.dialog, "unread_mark", False)
|
||||||
|
if hasattr(dialog, "dialog")
|
||||||
|
else False
|
||||||
|
)
|
||||||
|
|
||||||
|
if unread_count > 0:
|
||||||
|
chat_info += f", Unread: {unread_count}"
|
||||||
|
elif unread_mark:
|
||||||
|
chat_info += ", Unread: marked"
|
||||||
|
|
||||||
results.append(chat_info)
|
results.append(chat_info)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue