3
0
mirror of https://github.com/reality/dbot.git synced 2024-11-30 16:09:27 +01:00

yeah yeah

This commit is contained in:
reality 2015-01-09 01:11:47 +00:00
parent b2188ea036
commit d732440e3e

View File

@ -22,7 +22,7 @@ var gmaps = function(dbot) {
},
'json': true
}, function(err, response, body) {
if(!err && body && _.has(body, 'routes')) {
if(!err && body && _.has(body, 'routes') && _.has(body.routes[0], 'duration') && _.has(body.routes[0], 'indicativePrice')) {
var route = body.routes[0];
event.reply('If you left right now, it would take you ' + Math.floor(route.duration / 60) + ' hours and ' +
(route.duration % 60) + ' minutes to get the ' + Math.floor(route.distance) + 'KM from ' + from + ' to ' + to + ', and cost you about £' +