Skip to content
Snippets Groups Projects
Verified Commit 43b6f5af authored by Erick Hitter's avatar Erick Hitter
Browse files

Change layout to indicate location and PWS

parent 300f8643
Branches
No related tags found
No related merge requests found
......@@ -54,6 +54,8 @@ app.post('/post', function(req, res){
var weatherCondition = conditionData.current_observation.weather;
var icon_url = conditionData.current_observation.icon_url;
var location = conditionData.current_observation.display_location.full;
var obsLocation = conditionData.current_observation.observation_location.full;
var stationID = conditionData.current_observation.station_id;
parsed_url = url.format({
pathname: 'http://api.wunderground.com/api/' + apikey + '/forecast/q/' + req.body.text + format,
......@@ -63,21 +65,20 @@ app.post('/post', function(req, res){
// Basic response for the conditions data already obtained
var responseBody = {
"response_type": "in_channel",
"icon": icon_url,
"text": "Forecast",
"text": '**' + location + "**\n" + obsLocation + ' (' + stationID + ')',
"attachments": [
{
"text": "Location: " + location + "\n"
"text": "**Current conditions**\n"
+ "Temperature: " + temperature + "\n"
+ "Condition: " + weatherCondition,
"image_url": icon_url,
"image_url": icon_url
}
]
};
// If forecast wasn't available, return just the conditions
if ( error || 200 !== response.statusCode ) {
responseBody.attachments[1] = { "text":"Could not retrieve forecast" };
responseBody.attachments[1] = { "text": "Could not retrieve forecast" };
return res.send( responseBody );
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment