This commit is contained in:
reality 2015-01-09 01:43:20 +00:00
parent d732440e3e
commit 5621bad05c
2 changed files with 4 additions and 3 deletions

View File

@ -10,6 +10,7 @@
"bio": null, "bio": null,
"lastfm": null, "lastfm": null,
"steam": null, "steam": null,
"currency": null,
"goodreads": null, "goodreads": null,
"favourites": { "favourites": {
"colour": null "colour": null

View File

@ -18,15 +18,15 @@ var gmaps = function(dbot) {
'key': this.config.api_key, 'key': this.config.api_key,
'oName': from, 'oName': from,
'dName': to, 'dName': to,
'currencyCode': 'GBP' 'currencyCode': event.rProfile.currency || 'gbp'
}, },
'json': true 'json': true
}, function(err, response, body) { }, function(err, response, body) {
if(!err && body && _.has(body, 'routes') && _.has(body.routes[0], 'duration') && _.has(body.routes[0], 'indicativePrice')) { if(!err && body && _.has(body, 'routes') && _.has(body.routes[0], 'duration') && _.has(body.routes[0], 'indicativePrice')) {
var route = body.routes[0]; var route = body.routes[0];
event.reply('If you left right now, it would take you ' + Math.floor(route.duration / 60) + ' hours and ' + 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 £' + (route.duration % 60) + ' minutes to get the ' + Math.floor(route.distance) + 'KM from ' + from + ' to ' + to + ', and cost you about ' +
route.indicativePrice.price); route.indicativePrice.price + route.indicativePrice.currency);
} else { } else {
event.reply('Apparently one cannot get from ' + from + ' to ' + to + ' using public transport. Do you accept the challenge?'); event.reply('Apparently one cannot get from ' + from + ' to ' + to + ' using public transport. Do you accept the challenge?');
} }