Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

232
Vistas
find nearest location using node js and mysql telegram bot

I was trying to do a telegram bot that finds a nearby location using node js and mysql. but after finding users coordinate(latitude,Longitude) in mycase (mylat,mylng). i cant take the values out of the parenthesis. here is the index.js N.B all the configurations are done.

bot.on('location', (msg) => {   
const mylat=msg.location.latitude;
const mylng=msg.location.longitude;

console.log(msg.location.latitude);
console.log(msg.location.longitude);
getNearestLocation(Latitude,longitude).then(res=>{
  bot.sendMessage(msg.chat.id,res)
  bot.sendLocation(msg.chat.id, Latitude,longitude)

})  
  }); 
console.log(mylat); // i can't print here

The variables doesn't work out of bot.on('location'.......... parenthesis

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda