Exemplo n.º 1
0
        private string MakeReply(DiffBotResponse response)
        {
            var reply = new StringBuilder();

            if (!String.IsNullOrWhiteSpace(response.Title))
            {
                reply.AppendFormat(@"""{0}""", response.Title);
            }

            if (!String.IsNullOrWhiteSpace(response.Author))
            {
                reply.AppendFormat(" by {0}", response.Author);
            }

            if (!string.IsNullOrWhiteSpace(response.Summary))
            {
                // TODO: break on words
                reply.AppendFormat(" — {0}", response.Summary.Length <= 300 ? response.Summary : response.Summary.Substring(0, 300) + "…");
            }

            return(reply.ToString());
        }
Exemplo n.º 2
0
        private string MakeReply(DiffBotResponse response)
        {
            var reply = new StringBuilder();

            if (!String.IsNullOrWhiteSpace(response.Title))
            {
                reply.AppendFormat(@"""{0}""", response.Title);
            }

            if(!String.IsNullOrWhiteSpace(response.Author))
            {
                reply.AppendFormat(" by {0}", response.Author);
            }

            if(!string.IsNullOrWhiteSpace(response.Summary))
            {
                // TODO: break on words
                reply.AppendFormat(" — {0}", response.Summary.Length <= 300 ? response.Summary : response.Summary.Substring(0, 300) + "…");
            }

            return reply.ToString();
        }