S
S
Sergo Zar2021-07-27 19:56:02
Python
Sergo Zar, 2021-07-27 19:56:02

How to find out if a person is online in telgram?

I need to find out if a person is online in a telegram.
Tried like this

from pyrogram import Client, filters                                                               

app = Client("my_account")                                  with app:
    print(app.get_users("айди"))

But useful from this
{
     "_": "User",
    "id": айди,
    "is_self": false,
    "is_contact": true,
    "is_mutual_contact": false,
    "is_deleted": false,
    "is_bot": false,
    "is_verified": false,
    "is_restricted": false,
    "is_scam": false,
    "is_support": false,
    "first_name": "имя",
    "status": "recently",
    "username": "юзернейм",
    "dc_id": 2,
    "phone_number": "************",
    "photo": {
        "_": "ChatPhoto",
        "small_file_id": "айди фото",
        "big_file_id": "айди фото"
    }
}

I don't see anything.
Is there any way to find out if a person is online?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vindicar, 2021-07-27
@Sergomen

> "status": "recently",
Reading docs .

status (str, optional) – User's Last Seen & Online status. Can be one of the following: “ online ”, user is online right now. offline , user is currently offline. “ recently ”, user with hidden last seen time who was online between 1 second and 2-3 days ago. “ within_week ”, user with hidden last seen time who was online between 2-3 and seven days ago. “ within_month ”, user with hidden last seen time who was online between 6-7 days and a month ago. long_time_ago , blocked user or user with hidden last seen time who was online more than a month ago. None , for bots.

A
Alexey〒., 2021-07-27
@axifive

The user in the privacy settings can select the options for showing the latest activity:

  • All
  • None
  • Contacts

And you can also add a specific user to the exclusion list to show / hide status.
Accordingly, the "status" field for each will have a different behavior and you can find out if a person is online only if he leaves the default settings or wants to tell about it himself.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question