0

我尝试使用下面的 pyrogram 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()
4

1 回答 1

2

你想得到位置对象吗?

message.location.latitude
message.location.longitude

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

于 2021-05-30T17:55:41.097 回答