示例#1
0
        public AliceResponse WebHook([FromBody] AliceRequest request)
        {
            MessageToSocialNetwork answer = _rabbit.HandleUserMessage(new MessageFromSocialNetwork
            {
                Locale             = request.Meta.Locale == "ru-RU" ? "ru" : request.Meta.Locale,
                Text               = request.Request.OriginalUtterance,
                PlayerSocialId     = request.Session.UserId,
                ReplyBackQueueName = "alice"
            });

            return(new AliceResponse
            {
                Session = request.Session,
                Response = new ResponseModel
                {
                    Text = answer.Text,
                    Buttons = answer
                              .Suggestions
                              .Select(s => new ButtonModel
                    {
                        Title = s.Text
                    })
                              .ToArray()
                }
            });
        }