mirror of
https://github.com/bellingcat/telegram-phone-number-checker.git
synced 2026-06-07 19:08:31 +03:00
return richer account information (#21)
* added more fields for user information * Increment version to 1.1.0 (reflecting the new functionality) --------- Co-authored-by: Galen Reich <54807169+GalenReich@users.noreply.github.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
[tool.poetry]
|
||||
name = "telegram-phone-number-checker"
|
||||
version = "1.0.8"
|
||||
version = "1.1.0"
|
||||
description = "Check if phone numbers are connected to Telegram accounts."
|
||||
authors = ["Bellingcat"]
|
||||
license = "MIT"
|
||||
|
||||
@@ -30,12 +30,22 @@ def get_names(client: TelegramClient, phone_number: str) -> dict:
|
||||
# The response from DeleteContactsRequest contains more information than from ImportContactsRequest
|
||||
del_user = client(functions.contacts.DeleteContactsRequest(id=[users[0].get('id')]))
|
||||
user = del_user.to_dict().get('users')[0]
|
||||
user_was_online = user.get('status', {}).get('was_online')
|
||||
# getting more information about the user
|
||||
result.update({
|
||||
"id": user.get('id'),
|
||||
"username": user.get('username'),
|
||||
"first_name": user.get('first_name'),
|
||||
"last_name": user.get('last_name')
|
||||
"last_name": user.get('last_name'),
|
||||
"fake" : user.get('fake'),
|
||||
"verified" : user.get('verified'),
|
||||
"premium" : user.get('premium'),
|
||||
"mutual_contact" : user.get('mutual_contact'),
|
||||
"bot" : user.get('bot'),
|
||||
"bot_chat_history" : user.get('bot_chat_history'),
|
||||
"restricted" : user.get('restricted'),
|
||||
"restriction_reason" : user.get('restriction_reason'),
|
||||
"user_was_online": user_was_online.strftime("%Y-%m-%d %H:%M:%S %Z") if user_was_online else None
|
||||
})
|
||||
else:
|
||||
result.update({"error": f'This phone number matched multiple Telegram accounts, which is unexpected. Please contact the developer: contact-tech@bellingcat.com'})
|
||||
|
||||
Reference in New Issue
Block a user