Beispiel #1
0
        public static SkillResponse CreateResponseForNode(BaseNode node, Intent intent, Session session, ILambdaContext lambdaContext)
        {
            Dictionary <string, object> responseSessionAttributes = session.Attributes ?? new Dictionary <string, object>();

            while (node != null && !node.PausesStory)
            {
                node.ModifySessionAttributes(responseSessionAttributes, intent, session, lambdaContext);
                node = node.GetNextNode(intent, session, lambdaContext);
            }

            SkillResponse response = node.CreateResponse();

            // ModifySessionAttributes won't be called on a node which Pauses the story, so we call it manually here
            node.ModifySessionAttributes(responseSessionAttributes, intent, session, lambdaContext);
            response.SessionAttributes = responseSessionAttributes;

            return(response);
        }