def can_handle(self, handler_input): # type: (HandlerInput) -> bool return ask_utils.is_intent_name("removeItemIntent")(handler_input)
def can_handle(self, handler_input): return is_intent_name("SayNameIntent")(handler_input)
from scraper import * sb = SkillBuilder() @sb.request_handler(can_handle_func=is_request_type("LaunchRequest")) def launch_request_handler(handler_input): # type: (HandlerInput) -> Response speech_text = "Benvenuto in my tedx app. Come posso aiutarti?" handler_input.response_builder.speak(speech_text).set_card( SimpleCard("myTEDX", speech_text)).set_should_end_session(False) return handler_input.response_builder.response @sb.request_handler(can_handle_func=is_intent_name("get_next_event")) def get_next_event_intent_handler(handler_input): # type: (HandlerInput) -> Response translator = Translator() country_name = get_slot_value(handler_input=handler_input, slot_name="country_name") country_name_transl = translator.translate(country_name, src='it', dest='en').text print(country_name_transl) URL = f"https://www.ted.com/tedx/events?autocomplete_filter={country_name_transl}&when=upcoming" print(country_name) try: dict = extract_event_data(URL) except: speech_text = "Mi dispiace, al momento il sito di tedx non è raggiungibile"
def can_handle(self, handler_input): # type: (HandlerInput) -> bool return (ask_utils.is_intent_name("AMAZON.CancelIntent")(handler_input) or ask_utils.is_intent_name("AMAZON.StopIntent")(handler_input))
def can_handle(self, handler_input): return is_intent_name("AMAZON.HelpIntent")(handler_input)
def can_handle(self, handler_input): # type: (HandlerInput) -> bool session_attr = handler_input.attributes_manager.session_attributes return (is_intent_name("AMAZON.NoIntent")(handler_input) and "restaurant" in session_attr)
def can_handle(self, handler_input): # type: (HandlerInput) -> bool return ask_utils.is_intent_name("SetEmailIntent")(handler_input)
def can_handle(self, handler_input): # type: (HandlerInput) -> bool return ask_utils.is_intent_name("CaptureCardIntent")(handler_input)
else: speech_text = "Say next question to hear the next question." elif "selection_requested" in session_attr: if session_attr["selection_requested"] == "category": speech_text = "Do you want to select a category? You can select a category like Film or Books. You can skip selection. Questions from all the categories will be selected. Or you can ask about the available categories. " elif session_attr["selection_requested"] == "difficulty": speech_text = "Do you want to select a difficulty level? You can select easy, medium or hard. Or you can skip selection. Difficulty level will default to easy." else: speech_text = "Say yes to start the game or no to quit." else: speech_text = "Say yes to start the game or no to quit." return speech_text @sb.request_handler(can_handle_func=is_intent_name("AMAZON.HelpIntent")) def help_intent_handler(handler_input): """Handler for Help Intent.""" # type: (HandlerInput) -> Response session_attr = handler_input.attributes_manager.session_attributes speech_text = help_response(session_attr) reprompt = speech_text handler_input.response_builder.speak(speech_text).ask(reprompt) return handler_input.response_builder.response @sb.request_handler( can_handle_func=lambda input: is_intent_name("AMAZON.CancelIntent")(input) or is_intent_name("AMAZON.StopIntent")(input)) def cancel_and_stop_intent_handler(handler_input):
def can_handle(self, handler_input): return is_intent_name("dataDynamoIntent")(handler_input)
def can_handle(self, handler_input): return is_intent_name("StoreData")(handler_input)
def can_handle(self, handler_input): return is_intent_name("SilvanaTest")(handler_input)
def can_handle(self, handler_input): # type: (HandlerInput) -> bool print('hey005') return is_intent_name("AMAZON.CancelIntent")( handler_input) or is_intent_name("AMAZON.StopIntent")( handler_input)
def can_handle(self, handler_input): # type: (HandlerInput) -> bool print('hey005') return is_intent_name("HelloWorldIntent")(handler_input)
def can_handle(self, handler_input): if is_intent_name("AMAZON.YesIntent")(handler_input): return True
def can_handle(self, handler_input): return is_intent_name("DeviceLocationIntent")(handler_input)
handler = sb.lambda_handler() URL = "http://phish.in/api/v1" @sb.request_handler(can_handle_func=is_request_type("LaunchRequest")) def launch_request_handler(handler_input): speech_text = "Welcome to Phish Stream. What is the date of the show you would like to listen to?" card_text = "What is the date of the show?" display_text = "Phish Stream" handler_input.response_builder.speak(speech_text).set_card( SimpleCard(display_text, card_text)).set_should_end_session( False) return handler_input.response_builder.response @sb.request_handler(can_handle_func=is_intent_name("AMAZON.FallbackIntent")) def fallback(handler_input): speech_text = "Sorry, I don't understand. Can you say that again?" card_text = "Please say that again." display_text = "Phish Stream" handler_input.response_builder.speak(speech_text).set_card( SimpleCard(display_text, card_text)).set_should_end_session( False) return handler_input.response_builder.response @sb.request_handler(can_handle_func=is_intent_name("AMAZON.HelpIntent")) def help_intent_handler(handler_input): speech_text = ('''First, give me a date with a Phish concert to play. Afterwards, you can ask me to skip to the next track or go to a different set or encore. What would you like to do?''') card_text = "Tell me to play a show or skip a song."
def can_handle(self, handler_input): # type: (HandlerInput) -> bool return is_intent_name("GetNextCharityIntent")(handler_input)
def can_handle(self, handler_input): # type: (HandlerInput) -> bool return is_intent_name("AttractionIntent")(handler_input)
def can_handle(self, handler_input): # type: (HandlerInput) -> bool return is_intent_name("GetCharityInfoIntent")( handler_input) or is_intent_name("AMAZON.NoIntent")(handler_input)
def can_handle(self, handler_input): # type: (HandlerInput) -> bool return ask_utils.is_intent_name("AMAZON.HelpIntent")(handler_input)
def can_handle(self, handler_input): # type: (HandlerInput) -> bool attr = handler_input.attributes_manager.session_attributes return (is_intent_name("DefinitionIntent")(handler_input) and attr.get("state") == "QUIZ")
return [dish for dish in dishlist if ingredient_in_dish('vegan', dish) or \ ingredient_in_dish('vegetarisch', dish) or \ ingredient_in_dish('fisch', dish)] # meat is desired else: return [dish for dish in dishlist if not(ingredient_in_dish('vegan', dish) or \ ingredient_in_dish('vegetarisch', dish) or \ ingredient_in_dish('fisch', dish))] @sb.request_handler( can_handle_func=lambda input: is_intent_name("ListDishesIntent")(input)) def list_dishes_intent_handler(handler_input, current_date=None): # type: (HandlerInput) -> Response print("In ListDishesIntent") # extract slot values filled_slots = handler_input.request_envelope.request.intent.slots slot_values = get_slot_values(filled_slots) if current_date is None: current_date = slot_values['date']['resolved'] # extract (un)desired ingredients ingredients = {} ingredients['first'] = slot_values['first_ingredient']['resolved'] ingredients['first_prep'] = slot_values['first_prep']['resolved'] ingredients['second'] = slot_values['second_ingredient']['resolved'] ingredients['second_prep'] = slot_values['second_prep']['resolved']
def can_handle(self, handler_input): # type: (HandlerInput) -> bool return is_intent_name("AMAZON.FallbackIntent")(handler_input)
def can_handle(self, handler_input): return is_intent_name("AMAZON.FallbackIntent")(handler_input)
def can_handle(self, handler_input): # type: (HandlerInput) -> bool return (is_intent_name("AMAZON.CancelIntent")(handler_input) or is_intent_name("AMAZON.StopIntent")(handler_input) or is_intent_name("AMAZON.PauseIntent")(handler_input))
def can_handle(self, handler_input): return (is_intent_name("AMAZON.CancelIntent")(handler_input) or is_intent_name("AMAZON.StopIntent")(handler_input))
def can_handle(self, handler_input): # type: (HandlerInput) -> bool return (is_intent_name("QuizIntent")(handler_input) or is_intent_name("AMAZON.StartOverIntent")(handler_input))
def can_handle(self, handler_input): # type: (HandlerInput) -> bool return is_intent_name("E_eggIntent")(handler_input)
def can_handle(self, handler_input): # type: (HandlerInput) -> bool return (is_intent_name("SessionEndedRequest")(handler_input) or is_intent_name("AMAZON.NoIntent")(handler_input))