英文:
how to get specific timestamp from telethon GetLocatedRequest for each request?
问题
我想使用telethon的GetLocatedRequest功能,但我注意到,如果用户在关闭手机的位置服务之前刚刚使用了telethon的"附近"功能,telethon仍然会显示他/她在上次的位置。但你知道,在这段时间内,他/她可以更改位置。
我认为Telethon在用户激活"附近"功能时会保存某个时间戳,那么我如何获取这个时间戳?这将使我的数据更可靠。
谢谢
你可以在下面看到一个示例Telegram GetLocatedRequest功能的代码:
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,
accuracy_radius=42
),
self_expires=42
))
print(result)
请注意,上述代码中的"name"、"api_id"和"api_hash"需要替换为你自己的值。
英文:
`I want to use the telethon GetLocatedRequest, but I noticed that if the user used the telethon "nearby" feature just before turning off his/her phone's location service, the telethon still shows him/her at the last location. But you know he/she can change the location during this time.
I think Telethon is saving somewhere when the user activates the "nearby" feature, so how can I get this time/timestamp? This will make my data more reliable.
Thank you`
You can see an example telegram GetLocatedRequest feature code below.
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,
accuracy_radius=42
),
self_expires=42
))
print(result)
`
答案1
得分: 0
Telethon不缓存结果。这是Telegram服务器。如果Telegram不包括数据,你只能猜测。
最好不要拥有如此精确的位置信息。
英文:
Telethon is not caching the result. It is the Telegram server. If Telegram does not include the data, you can only guess.
It's probably safer to not have such accurate location information available.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论