public AliceResponse( AliceRequest request, SessionState sessionState = default, UserState userState = default ) : base(request, sessionState, userState) { }
public AliceResponse Generate(AliceRequest request, UserState newUserState = null, SessionState newSessionState = null) { var(text, tts) = GetTextTtsPair(request.HasScreen()); var response = new AliceResponse(request, newSessionState, newUserState) { Response = { Text = text, Tts = tts, Buttons = Buttons?.Select(b => { var bData = b.Split("!"); return(bData.Length == 1 ? new Button(b) : new Button(bData[0]) { Url = bData[1],Hide= false }); }).ToList() } }; if (Images != null && Images.Length > 0) { var description = text .Replace("\\n", " ") .Replace(" ", " ") .SafeSubstring(256); if (Images.Length == 1) { var imgData = Images[0].Split("!"); response.Response.Card = imgData.Length > 1 ? new SingleCard(imgData[0], new Button(imgData[1])) { Description = description } : new SingleCard(imgData[0]) { Description = description }; } else { response.Response.Card = new GalleryCard(Images.Select(i => { var iData = i.Split("!"); return(iData.Length > 1 ? new GalleryItem(iData[0], iData[1]) : new GalleryItem(i)); })); } } return(response); }
public AliceResponse(AliceRequest request) { Session = request.Session; Version = request.Version; }
public AliceResponce(AliceRequest request) { Session = request.Session; }