This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from ask_sdk_core.skill_builder import SkillBuilder | |
from ask_sdk_core.dispatch_components import AbstractRequestHandler, AbstractExceptionHandler | |
from ask_sdk_core.utils import is_request_type, is_intent_name | |
from ask_sdk_core.handler_input import HandlerInput | |
import logging | |
import six |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sb = SkillBuilder() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
logger = logging.getLogger(__name__) | |
logger.setLevel(logging.DEBUG) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class LaunchRequestHandler(AbstractRequestHandler): | |
def can_handle(self, handler_input): | |
return is_request_type("LaunchRequest")(handler_input) | |
def handle(self, handler_input): | |
speechText = "<say-as interpret-as=\"interjection\">Hey Exploradores!</say-as>, espero estéis listos para una nueva aventura. ¿Cuántos objetos queréis buscar hoy?." | |
rePrompt = "<say-as interpret-as=\"interjection\">Venga exploradores!</say-as>. A la aventura, ¿Cuantos objetos queréis buscar hoy?" | |
return handler_input.response_builder.speak(speechText).ask(rePrompt).set_should_end_session(False).response |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class HelpIntentHandler(AbstractRequestHandler): | |
def can_handle(self, handler_input): | |
return is_intent_name("AMAZON.HelpIntent")(handler_input) | |
def handle(self, handler_input): | |
speechText = "Bienvenidos a la ayuda de Exploradores Fantásticos!. Sólo debes decirme una número o dejar que decida yo el número de objetos que buscaréis" | |
return handler_input.response_builder.speak(speechText).response |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CancelAndStopIntentHandler(AbstractRequestHandler): | |
def can_handle(self, handler_input): | |
return (is_intent_name("AMAZON.CancelIntent")(handler_input) or | |
is_intent_name("AMAZON.StopIntent")(handler_input)) | |
def handle(self, handler_input): | |
speechText = "Hasta la próxima aventura exploradores!." | |
return handler_input.response_builder.speak(speechText).response |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SessionEndedRequestHandler(AbstractRequestHandler): | |
def can_handle(self, handler_input): | |
return is_request_type("SessionEndedRequest")(handler_input) | |
def handle(self, handler_input): | |
handler_input.response_builder.response |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AllExceptionsHandler(AbstractExceptionHandler): | |
def can_handle(self, handler_input, exception): | |
return True | |
def handle(self, handler_input, exception): | |
speechText = "Lo siento, no he comprendido lo que me has dicho. Di, ayuda, para obtener más información sobre cómo jugar." | |
return handler_input.response_builder.speak(speechText).response |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ListItemsIntent(AbstractRequestHandler): | |
def can_handle(self, handler_input): | |
return is_intent_name("ListItemsIntent")(handler_input) | |
def handle(self, handler_input): | |
slots = handler_input.request_envelope.request.intent.slots | |
defaultObjsToSearch = 3 | |
for slotName, currentSlot in six.iteritems(slots): | |
if slotName == 'numObj': |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from random import sample |
OlderNewer