pyrogram - Telegram API 获取实时位置更新

pyrogram - Telegram API to get live location update

我尝试使用下面的热图 API 代码获取实时位置更新,但在位置变量中获取 None。

from pyrogram import Client
from pyrogram import filters

app = Client("my_account",api_id=API_ID,api_hash=API_HASH)

@app.on_message(filters.location)
async def location(client, message):
    print("Location received...")
    print(message.location)
app.run()

您要获取位置对象吗?

message.location.latitude
message.location.longitude

https://docs.pyrogram.org/api/types/Location#pyrogram.types.Location