/// <summary>
        /// Proccesses a given user and their expected intents.
        /// </summary>
        /// <param name="user">The user to apply this particular intent to</param>
        /// <param name="userIntents">The new intent state that the client has requested</param>
        public void SetIntent(User user, UserIntents userIntents)
        {
            // Assign the intents directly
            user.UserIntents = userIntents;

            //TODO:  Fire off an event to any service that might be listening that cares for this sort of thing
        }
        /// <summary>
        /// POST: api/Messages
        /// Receive a message from a user and reply to it
        /// </summary>
        public async Task <HttpResponseMessage> Post([FromBody] Activity activity)
        {
            Config.ConnectConfig.Connector       = new ConnectorClient(new Uri(activity.ServiceUrl));
            Config.ConnectConfig.CurrentActivity = activity;

            Activity reply = null;

            if (activity.Type == ActivityTypes.Message)
            {
                var userInput = await Helpers.LuisHelper.ParseUserInput(Config.ConnectConfig.CurrentActivity.Text);

                UserIntents userIntent = UserIntents.None;

                Enum.TryParse(userInput.intents.First().intent, true, out userIntent);

                string message = "You Selected " + userIntent.ToString();

                switch (userIntent)
                {
                case UserIntents.LatestNews:
                    reply = await Helpers.TrendingNewsHelper.GetNews(Config.ConnectConfig.Connector, Config.ConnectConfig.CurrentActivity);

                    break;

                case UserIntents.Greeting:
                    //TODO: Add a Dialog
                    break;
                }
                await Conversation.SendAsync(Config.ConnectConfig.CurrentActivity, OrderChipotleDialog);
            }
            else
            {
                HandleSystemMessage(activity);
            }
            var response = Request.CreateResponse(HttpStatusCode.OK);

            return(response);
        }
Exemple #3
0
 public UserIntentChangePacket(UserIntents userIntents)
 {
     UserIntents = userIntents;
 }