[Python] telethon always gives 0 unread messages count from all private chats

Discussão em 'Python' iniciado por Stack, Agosto 27, 2025.

  1. Stack

    Stack Membro Participativo

    The code from "X" keeps showing wrong amount of unread messages. I've added a "result" that actually shows a real count of unread messages from Dena account.

    with TelegramClient(session, api_id, api_hash) as client:
    result = client(functions.messages.GetPeerDialogsRequest(
    peers=['eXploit00'] # Dena account
    ))
    print(result.dialogs[0].unread_count)
    x = [[d.unread_count, d.title] for d in client.get_dialogs() if
    not getattr(d.entity, 'is_private', False) and d.unread_count <= 4]
    print(x)


    The output:
    3 (real unreaded count messages from Dena)
    [[0, 'Denа'], [0, 'Gma....

    Tried to change is_private to True, and then it starts giving an empty list.

    Continue reading...

Compartilhe esta Página