def search_hotel_at_dest(request, responder): l_t.delIntent() id = request.params.dynamic_resource['id'] _,_,_,res = firebase.getHotelPref(id) if res is None: responder.params.target_dialogue_state = "set_hotel_pref" responder.reply("Sure, please first tell us the preferences for the hotels (number of rooms/ac/non-ac/etc)") else: spot_name = request.entities[0]["value"][0]["cname"] lat,long = _fetch_spot_from_kb(spot_name) print(lat,long) hotel_msg = hotelList(id,lat,long) if hotel_msg is None: responder.reply("Currently, We don't have any hotel preferences for you😕.\nYou can set your preference saying. ➡" + _fetch_hotel_pref_suggestion()["suggestion"]) else: r,b,p,a = firebase.getHotelPref(id) if a==0: a='non ac' else: a='ac' pref = ' '.join([r,b,p,a]) responder.frame["for_confirmation"] = 1 responder.frame["for_confirmation_message"] = "Yupp"+"~"+"I have found some hotel🏘 at your destination"+"~"+"Check out the following list of hotels:\n~"+hotel_msg responder.frame["for_denial"] = 1 responder.frame["for_denial_message"] = "Ok, please first tell us the preferences for the hotels (number of rooms/ac/non-ac/etc)" responder.reply("Your previous preferences for hotel was: "+pref+"\nWould you like to continue")
def present_city(request, responder): print('f') id = request.params.dynamic_resource['id'] city_name = request.entities[0]["value"][0]["cname"] lat, long = fetch_city_coord_from_kb(city_name) intent = l_t.getIntent() hotel_msg = res_msg = '' if intent == 'loc_for_hotel': hotel_msg = hotelList(id, lat, long) if hotel_msg is None: responder.reply("We don't have any hotels for you😕.") else: responder.reply( "I have found some hotels at your current location." + "~" + "Checkout the following list of hotels:\n~" + hotel_msg + "\n") elif intent == 'loc_for_food': res_msg = getRestaurant(id, lat, long) if res_msg: responder.reply( "Yummy food is waiting for you😋!~I found some restaurants at your current location:\nHere is the list of restaurants you can check it out:\n\n" + res_msg) else: responder.reply("We don't have any restaurants for you😕.") else: pass l_t.delIntent()
def search_hotel_at_curr(request, responder): l_t.delIntent() # code for getting nearest_city for the loc id = request.params.dynamic_resource['id'] lat,long = firebase.getCurrLocation(id) # end _,_,_,res = firebase.getHotelPref(id) print(res) if res is None: responder.params.target_dialogue_state = "set_hotel_pref" responder.reply("Sure, please first tell us the preferences for the hotels (number of rooms/ac/non-ac/etc)") else: try: # code for getting hotels list hotel_msg = hotelList(id,lat,long) if hotel_msg is None: responder.reply("We don't have any hotels for you😕. You can always try saying "+ _fetch_find_hotel_in_suggestion()["suggestion"] + firebase.getDest(id)) else: responder.reply("I have found some hotels at your current location."+"~"+"Checkout the following list of hotels:\n~"+hotel_msg+"\n") except : responder.reply("Ooops!"+"~"+"Sorry..We couldn't find best hotels at your current location😕."+"~"+"Please try sending your location again")
def present_city(request, responder): print('f') id = request.params.dynamic_resource['id'] city_name = request.entities[0]["value"][0]["cname"] lat, long = fetch_city_coord_from_kb(city_name) intent = l_t.getIntent() hotel_msg = res_msg = '' if intent == 'loc_for_hotel': hotel_msg = hotelList(id, lat, long) if hotel_msg is None: responder.reply("We don't have any hotels for you😕.") else: responder.reply( "I have found some hotels at your current location." + "~" + "Checkout the following list of hotels:\n~" + hotel_msg + "\n") elif intent == 'loc_for_food': res_msg = getRestaurant(id, lat, long) if res_msg: responder.reply( "Yummy food is waiting for you😋!~I found some restaurants at your current location:\nHere is the list of restaurants you can check it out:\n\n" + res_msg) else: responder.reply("We don't have any restaurants for you😕.") elif intent == 'loc_for_source': responder.reply( "Your current location has been set. Feel free to search hotels and restaurants near you" ) else: lat, long = fetch_city_coord_from_kb(city_name) location = {'Latitude': lat, 'Longitude': long} result = firebase.setCurrLocation(location, id) responder.reply( "Your current location has been set. Feel free to search hotels and restaurants near you" ) l_t.delIntent()
def search_nearby_hotel(request,responder): print('f') l_t.delIntent() id = request.params.dynamic_resource['id'] _,_,_,res = firebase.getHotelPref(id) if res is None: responder.params.target_dialogue_state = "set_hotel_pref" responder.reply("Sure, please first tell us the preferences for the hotels (number of rooms/ac/non-ac/etc)") else: try: lat,long = firebase.getCurrLocation(id) if lat and long: hotel_msg = "We are facing issue with our scrapper rght now." try: hotel_msg = hotelList(id,lat,long) except: responder.reply(hotel_msg) if hotel_msg == '': responder.reply("Currently, We don't have any hotels for you😕 But you can always try saying find hotels near " + firebase.getDest(id)+"~"+"I will be there to help you 🙂") else: r,b,p,a = firebase.getHotelPref(id) if a==0: a='non ac' else: a='ac' pref = ' '.join([r,b,p,a]) responder.frame["for_confirmation"] = 1 responder.frame["for_confirmation_message"] = "I have found some hotels🛏 near by you, you can check it out:\n~"+hotel_msg responder.frame["for_denial"] = 1 responder.frame["for_denial_message"] = "Ok, please first tell us the preferences for the hotels (number of rooms/ac/non-ac/etc)" responder.reply("Your previous preferences for hotel was: "+pref+"\nWould you like to continue") else : responder.reply("I Didn't understand😕.\n Try saying find hotels near " + firebase.getDest(id)) except (TypeError): responder.params.target_dialogue_state = "search_at_curr" responder.reply("Oops ! Sorry, can you please share your location first so that I can assist you in finding hotels nearby you...🙂")