(async () => {
try {
const response = await fetch('http://ip-api.com/json/' + getinfo_ip[1])
const response_1 = await fetch('http://ip-api.com/json/' + getinfo_ip[2])
const json = await response.json()
const json_1 = await response_1.json()
let result_dist = distance(json.lat, json.lon, json_1.lat, json_1.lon)
if (result_dist != null || result_dist != undefined) {
messagesend('Result: ' + getinfo_ip[1] + ' -> ' + getinfo_ip[2] + '\nDistance: ' + Math.round(result_dist, 1) + 'km')
} else {
messagesend('Что-то не так вводишь')
}
console.log(json);
} catch (error) {
console.log(error);
}
})();