/// <summary> /// Shows image based on given phraase. /// </summary> /// <param name="activity">current activity</param> /// <param name="phraase">given phrase</param> /// <returns></returns> public async Task <HttpResponseMessage> ShowImage([Microsoft.AspNetCore.Mvc.FromBody] Activity activity, string phraase) { // Check, if line can be processed if (!IsToProcess(phraase)) { return(null); } // Leave only passed url or phrase var entered = phraase.TrimStart().ToLower().Substring("show-image|".Length).Trim(); // Assert presence of util to process requests AssureNN_UtilRequest(); ConnectorClient connector = new ConnectorClient(new Uri(activity.ServiceUrl)); Activity reply = activity.CreateReply(entered); reply.Recipient = activity.From; reply.Type = "message"; reply.Attachments = new List <Attachment>(); if (entered.Equals("author") || entered.Equals("who made you")) { // Show author's github avatar reply.Attachments.Add(new Attachment() { ContentUrl = "https://avatars2.githubusercontent.com/u/12435750?s=460&v=4", ContentType = "image/png", Name = "ttrzcinski.png" }); } else if (UtilRequest.IsURL(entered)) { // Show requested ur.l's image reply.Attachments.Add(new Attachment() { ContentUrl = entered, ContentType = "image/png", Name = "downloaded_from_url.png" }); // TODO show first image with given phrase } else { // Show default image reply.Attachments.Add(new Attachment() { ContentUrl = "https://upload.wikimedia.org/wikipedia/commons/thumb/1/1f/Creative-Tail-Animal-duck.svg/128px-Creative-Tail-Animal-duck.svg.png", ContentType = "image/png", Name = "robot.png" }); } await connector.Conversations.ReplyToActivityAsync(reply); return(new HttpResponseMessage(HttpStatusCode.Accepted)); }