I want to use the new "People nearby" feature from Telegram. I want to do it in python so I found Telethon.
Then, I looked at the Telegram API and found the contacts.getLocated()
method.
https://core.telegram.org/method/contacts.getLocated
But this method is not available in the Telethon library I think. Or at least I didnt found how to call it.
from telethon import functions
functions.contacts.getLocated()
gave me:
AttributeError: module 'telethon.tl.functions.contacts' has no attribute 'getLocated'
Can I call this method in any other way? Do I even have to use Telethon for this?
The Telethon documentation on full API explains how to use all of the raw Telegram methods have to offer. Searching for "get located" we find GetLocatedRequest
. There is a button to copy the import, and also example code at the bottom:
from telethon.sync import TelegramClient
from telethon import functions, types
with TelegramClient(name, api_id, api_hash) as client:
result = client(functions.contacts.GetLocatedRequest(
geo_point=types.InputGeoPoint(
lat=7.13,
long=7.13
),
self_expires=42
))
print(result.stringify())
Needless to say you need to pass the right values in the geo point.