def get_handler():
    sb = StandardSkillBuilder(table_name="GoogleClassroomStates",\
        auto_create_table=True)
    sb.add_request_handler(PermissionChangedEventHandler())
    sb.add_request_handler(ProactiveSubscriptionChanged())
    sb.add_request_handler(AccountLinkedEventHandler())
    return sb.lambda_handler()
Example #2
0
def build_skill() -> Callable:
    sb = StandardSkillBuilder()

    sb.add_request_handler(GetStatusIntentHandler())
    sb.add_request_handler(AutoConditioningStartIntentHandler())
    sb.add_request_handler(AutoConditioningStopIntentHandler())
    sb.add_request_handler(ChargeStartIntentHandler())
    sb.add_request_handler(ChargeStopIntentHandler())
    sb.add_request_handler(DoorLockIntentHandler())
    sb.add_request_handler(DoorUnlockIntentHandler())
    sb.add_exception_handler(CatchAllExceptionHandler())

    return sb.lambda_handler()
Example #3
0
@sb.request_handler(can_handle_func=lambda input: True)
def unhandled_intent_handler(handler_input):
    """Handler for all other unhandled requests."""
    # type: (HandlerInput) -> Response
    speech = "I don't know what to do. Please say again!!"
    handler_input.response_builder.speak(speech).ask(speech)
    return handler_input.response_builder.response


@sb.exception_handler(can_handle_func=lambda i, e: True)
def all_exception_handler(handler_input, exception):
    """Catch all exception handler, log exception and
    respond with custom message.
    """
    # type: (HandlerInput, Exception) -> Response
    logger.error(exception, exc_info=True)
    speech = "Sorry, I can't understand that. Please say again!!"
    handler_input.response_builder.speak(speech).ask(speech)
    return handler_input.response_builder.response


@sb.global_response_interceptor()
def log_response(handler_input, response):
    """Response logger."""
    # type: (HandlerInput, Response) -> None
    logger.info("Response: {}".format(response))


lambda_handler = sb.lambda_handler()
Example #4
0
sb.add_request_handler(AudioNextIntentHandler())
sb.add_request_handler(AudioPlaybackFinishedHandler())
sb.add_request_handler(AudioPlaybackNearlyFinishedHandler())
sb.add_request_handler(AudioPlaybackStartedHandler())
sb.add_request_handler(AudioPlaybackStoppedHandler())
sb.add_request_handler(AudioPreviousIntentHandler())
sb.add_request_handler(AudioResumeIntentHandler())
sb.add_request_handler(AudioStartOverIntentHandler())
sb.add_request_handler(AudioStopIntentHandler())
sb.add_request_handler(AudioUnsupportedHandler())

sb.add_request_handler(CalendarEventHandler())
sb.add_request_handler(ConfessionHandler())
sb.add_request_handler(CancelAndStopIntentHandler())
sb.add_request_handler(FallbackIntentHandler())
sb.add_request_handler(HelpIntentHandler())
sb.add_request_handler(LatestHomilyHandler())
sb.add_request_handler(LatestTalkHandler())
sb.add_request_handler(LaunchRequestHandler())
sb.add_request_handler(MassTimeHandler())
sb.add_request_handler(NextMassHandler())
sb.add_request_handler(NotifyNextMassHandler())
sb.add_request_handler(ParishPhoneHandler())
sb.add_request_handler(SessionEndedRequestHandler())

sb.add_exception_handler(ExceptionHandler())

sb.add_global_request_interceptor(RequestLogger())
sb.add_global_response_interceptor(ResponseLogger())
handler = sb.lambda_handler()  # pylint: disable=C0103
Example #5
0
skill_builder.add_request_handler(ShuffleOnEpisodeHandler())
skill_builder.add_request_handler(ShuffleOffEpisodeHandler())
skill_builder.add_request_handler(StartOverEpisodeHandler())
skill_builder.add_request_handler(RepeatEpisodeHandler())
skill_builder.add_request_handler(PreviousEpisodeHandler())
skill_builder.add_request_handler(NextEpisodeHandler())
skill_builder.add_request_handler(LoopOnEpisodeHandler())
skill_builder.add_request_handler(LoopOffEpisodeHandler())
skill_builder.add_request_handler(HelpHandler())
skill_builder.add_request_handler(FallbackHandler())

# Event Handlers
skill_builder.add_request_handler(PlaybackNearlyFinishedHandler())
skill_builder.add_request_handler(PlaybackFailedHandler())
skill_builder.add_request_handler(PlaybackStartedHandler())
skill_builder.add_request_handler(PlaybackStoppedHandler())
skill_builder.add_request_handler(PlaybackFinishedHandler())

# Request Interceptors
skill_builder.add_global_request_interceptor(RequestLogger())
skill_builder.add_global_request_interceptor(LoadStateRequestInterceptor())

# Response Interceptors
skill_builder.add_global_response_interceptor(ResponseLogger())
skill_builder.add_global_response_interceptor(SaveStateResponseInterceptor())

# Exception Handler
skill_builder.add_exception_handler(CatchAllExceptionHandler())

lambda_handler = skill_builder.lambda_handler()
Example #6
0
from ask_sdk.standard import StandardSkillBuilder

from fallzahlen.handlers.today_handler import TodayIntentHandler
from fallzahlen.handlers.close_handler import CloseRequestHandler
from fallzahlen.handlers.help_handler import HelpHandler
from fallzahlen.handlers.fallback_handler import FallbackHandler
from fallzahlen.handlers.exception_handler import ExceptionHandler

builder = StandardSkillBuilder()
builder.add_request_handler(TodayIntentHandler())
builder.add_request_handler(CloseRequestHandler())
builder.add_request_handler(HelpHandler())
builder.add_request_handler(FallbackHandler())
builder.add_exception_handler(ExceptionHandler())

handler = builder.lambda_handler()
Example #7
0
@_sb.global_request_interceptor()
def process(handler_input: HandlerInput) -> None:
    """Process the locale in request and load localized strings for response.
    This interceptors processes the locale in request, and loads the locale
    specific localization strings for the function `_`, that is used during
    responses.
    """
    locale = getattr(handler_input.request_envelope.request, 'locale', None)
    _logger.info("Locale is {}".format(locale))
    if locale:
        if locale.startswith("fr"):
            locale_file_name = "fr-FR"
        elif locale.startswith("it"):
            locale_file_name = "it-IT"
        elif locale.startswith("es"):
            locale_file_name = "es-ES"
        else:
            locale_file_name = locale

        _logger.info("Loading locale file: {}".format(locale_file_name))
        i18n = gettext.translation('data', localedir='locales', languages=[locale_file_name], fallback=True)
        handler_input.attributes_manager.request_attributes["_"] = i18n.gettext
    else:
        handler_input.attributes_manager.request_attributes["_"] = gettext.gettext


_logger.info('Loading Alexa Assistant...')

# Handler name that is used on AWS lambda
lambda_handler = _sb.lambda_handler()