def handle(self, handler_input): print('PlayGameHandler ----------------------') attrs_manager = handler_input.attributes_manager request_attrs = attrs_manager.request_attributes session_attrs = attrs_manager.session_attributes is_first_question = int(session_attrs.get('current_question', 0)) <= 1 key = 'PLAY_GAME_FIRST_QUESTION' if is_first_question else 'PLAY_GAME_MID_GAME' message = utils._( key, {'current_question': session_attrs['current_question']}) request_attrs['output_speech'].append(message['output_speech']) Game.ask_question(handler_input, False) return handler_input.response_builder.response
def handle(self, handler_input): print('DontKnowNextHandler ----------------------') attrs_manager = handler_input.attributes_manager request_attrs = attrs_manager.request_attributes session_attrs = attrs_manager.session_attributes session_attrs['current_question'] = int( session_attrs.get('current_question', 0)) + 1 is_last_question = session_attrs['current_question'] > settings.GAME[ 'questions_per_game'] key = 'SKIP_LAST' if is_last_question else 'SKIP' message = utils._(f"PLAY_GAME_{key}_QUESTION") request_attrs['output_speech'].append( f"{message['output_speech']}<break time='1s'/>") Game.ask_question(handler_input, False) return handler_input.response_builder.response
def handle(self, handler_input): print('YesHandler ----------------------') Game.ask_question(handler_input, False) return handler_input.response_builder.response