如何从Telethon的GetLocatedRequest中获取每个请求的特定时间戳?

huangapple go评论71阅读模式
英文:

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.

huangapple
  • 本文由 发表于 2023年7月24日 16:23:01
  • 转载请务必保留本文链接:https://go.coder-hub.com/76752617.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定