Answer the question
In order to leave comments, you need to log in
How to pass the result of a function to a user in a Telegram bot?
There is an api function in node js that pulls the weather by coordinates
forecast.get([53.2608259,50.0579958], function (err, result) {
if (err) {
return console.dir(err);
}
console.log('Долгота: %s', result.latitude);
console.log('Широта: %s', result.longitude);
console.log('Временная зона: %s', result.timezone);
console.log('Сейчас на улице: %s\nТемпература: %s°C\nВлажность воздуха: %s% ',
result.currently.summary,
Math.round(parseFloat(result.currently.temperature, 10)),
result.currently.humidity * 100
);
});
forecast.get([53.2608259,50.0579958], function (err, result) {
if (err) {
return console.dir(err);
}
const html= `<i>Погода на сегодня</i>`;
bot.sendMessage(helper.getChatId(msg), html,{
parse_mode:'HTML'
})
);
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question