dcupachatbot
Version:
DCU Personal Assistant chat bot for CA400 project
63 lines (55 loc) • 2.34 kB
JavaScript
;
var HashMap = require('hashmap');
var request = require('request');
var getBuildingLocation = function getBuildingLocation(buildingID, callback) {
var buildingIDCase = buildingID.toLowerCase();
var map = new HashMap();
var isBuilding = false;
map
.set("Sports Club and Accommodation", "The Sports Club is attached to the Hub on the left hand side.")
.set("Albert College", "Albert College is attached to the Canteen and located beside the Hamilton building.")
.set("BEA Orpen", "The BEA Orpen is located between both of the Postgraduate Accommodation buildings.")
.set("College Park Residence", "The College Park Residences are located at the very back of the Sports Building and behind the Hamstead and Larkfield Accommodations.")
.set("Créche", "The Créche is located in the car par directly beside the Helix.")
.set("The Mall", "The Mall is the grassy area located in the centre of DCU.")
.set("DCU Business School", )
.set("Estate Offices", "The estate offices are located at the entrance to the Collins Avenue pedestrian entrance on the right hand side.")
.set("Nursing Building, Exwell Medical and Healthy Living Centre", )
.set("Hamilton Building", )
.set("Hamstead Residences", )
.set("The Helix", )
.set("Henry Grattan", )
.set("Invent", )
.set("Interfaith", )
.set("The Library", )
.set("Larkfield Residences", )
.set("Larkin Lecture Theatre", )
.set("Lonsdale/Science Building", )
.set("Marconi/Physics Building", )
.set("Multi-Storey Carpark", )
.set("NICB", )
.set("NRF", )
.set("Pavilion", )
.set("Postgraduate Residences", )
.set("Postgraduate Residences", )
.set("Reception", )
.set("Restaurant / Canteen", )
.set("Stokes Building", )
.set("The Hub", )
.set("Nubar", 'The Nubar is located in the Hub at the doors closest to the sports club.')
.set("Spar", )
.forEach(function(value, key) {
var valCase = value.toLowerCase();
if(valCase.indexOf(buildingIDCase) > -1) {
var reply = 'The ' + buildingID + ' building has letter ' + key;
isBuilding = true;
callback(reply);
}
});
if(!isBuilding)
{
var reply = 'There is no building with that name';
callback(reply);
}
};
module.exports = getBuildingLocation;