python-telegram icon indicating copy to clipboard operation
python-telegram copied to clipboard

User information is never updated.

Open BritishTeapot opened this issue 9 months ago • 0 comments

When I run my code:

from datetime import datetime
from telegram import __version__ as pt_version
from telegram.client import Telegram
import argparse

    ...logged in here...

    result = tg.get_user(user_id)
    result.wait()
    print(result.update)
    if "status" in result.update:
        ts = result.update["status"]
        if "was_online" in ts:
            print(
                "The user was online at:"
                + datetime.fromtimestamp(ts["was_online"]).strftime("%Y-%m-%d %H:%M:%S")
            )
    tg.stop()

I always get exactly the same user last online status, despite it was clearly changed in the normal telegram desktop. I am not getting any warnings or errors from tdlib (even with increased verbosity).

I have tried:

  • Adding this:
    result = tg.get_chats()
    result.wait()
    
    before result = tg.get_user(user_id)
  • Removing the database (worked, but I don't want to re-login every time I run the script).

What am I missing?

Platform: Fedora Linux tdlib version: 1.8.46, compiled from source python-telegram version: 0.19.0

BritishTeapot avatar Mar 25 '25 14:03 BritishTeapot