Answer the question
In order to leave comments, you need to log in
How to get geolocation via Telegram bot using inline?
If you use a bot in Telegram via Inline, then the bot can request the user's location if it is enabled in the bot settings. The geo member in the telethon.events.inlinequery.InlineQuery class is responsible for getting the geolocation .
Here is the code through which I tried to get the geolocation in order to use latitude and longitude in the future:
from telethon import TelegramClient, events
@client.on(events.InlineQuery)
async def handler(event):
location = event.geo
builder = event.builder
await event.answer([
builder.article("Координаты", text="Долгота: " + location.long + " Широта: " + location.lat),
])
AttributeError: 'NoneType' object has no attribute 'lat'.
Answer the question
In order to leave comments, you need to log in
Hmm ... Apparently, this is your question. There is an answer there.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question