Telgram Bot Handler for coordinates
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
parent
d53ac819a6
commit
577de989b9
@ -34,15 +34,24 @@ async def help_command(update: Update):
|
|||||||
await update.message.reply_text(f"Help! How can I assist you, {user.first_name}?")
|
await update.message.reply_text(f"Help! How can I assist you, {user.first_name}?")
|
||||||
|
|
||||||
|
|
||||||
async def handle_location(update: Update):
|
async def handle_location(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
|
||||||
"""Respond to a location message."""
|
"""Respond to a location message by sending back the dynamic Digital Twin link."""
|
||||||
location = update.message.location
|
location = update.message.location
|
||||||
if location:
|
if not location:
|
||||||
await update.message.reply_text(
|
|
||||||
f"Thanks for sharing your location! Latitude: {location.latitude}, Longitude: {location.longitude}"
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
await update.message.reply_text("Please share your location.")
|
await update.message.reply_text("Please share your location.")
|
||||||
|
return
|
||||||
|
|
||||||
|
lat = location.latitude
|
||||||
|
lon = location.longitude
|
||||||
|
reply = (
|
||||||
|
"🚀 Your Digital Twin is ready!\n\n"
|
||||||
|
f"🌍 Latitude: {lat}\n"
|
||||||
|
f"🌍 Longitude: {lon}\n\n"
|
||||||
|
"🔗 Access it here:\n"
|
||||||
|
f"https://app.polisplexity.tech/city/digital/twin/osm_city/?lat={lat}&long={lon}&scale=0.1\n\n"
|
||||||
|
"Thanks for sharing your location!"
|
||||||
|
)
|
||||||
|
await update.message.reply_text(reply)
|
||||||
|
|
||||||
|
|
||||||
async def respond(update, bot_name):
|
async def respond(update, bot_name):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user