Exemplo n.º 1
0
def read_history(client: Client, cid: int) -> bool:
    # Mark messages in a chat as read
    try:
        flood_wait = True
        while flood_wait:
            flood_wait = False
            try:
                client.read_history(chat_id=cid)
            except FloodWait as e:
                flood_wait = True
                wait_flood(e)

        return True
    except Exception as e:
        logger.warning(f"Read history in {cid} error: {e}", exc_info=True)

    return False
Exemplo n.º 2
0
def read_history(client: Client, cid: int) -> bool:
    # Mark messages in a chat as read
    result = False

    try:
        result = client.read_history(chat_id=cid) or True
    except FloodWait as e:
        raise e
    except Exception as e:
        logger.warning(f"Read history in {cid} error: {e}", exc_info=True)

    return result
Exemplo n.º 3
0
def autoseen(app: Client, msg: Message):
    chatid = str(msg.chat.id)
    if chatid in r.smembers("mark"):
        app.read_history(chatid)