/// <summary> /// Generates the comment text, with at most 25 linked items from the author. /// Header will include a total count and a signature line. /// </summary> /// <returns>The comment text.</returns> /// <param name="user">User to generate text for.</param> string generateCommentText(string username) { int count = 0; string comm = ""; Listing <Post> allPosts = reddit.GetPostsByUser(username, Sort.New, 100); foreach (Post post in allPosts) { if (post.SubredditName.Equals(sub.Name) && isOC(post)) { if (count < 25) { comm += "\n* [" + post.Title + "](" + post.Url + ")"; } post.SelfText = null; // attempt to reduce space usage by dereffing the big text blocks post.SelfTextHtml = null; ++count; } } if (count > 25) { string leadin = "There are many stories by " + authorLink(username) + ", including:\n"; comm = leadin + comm; } else if (count > 1) { string leadin = "There are at least " + count + " stories by " + authorLink(username) + ", including:\n"; comm = leadin + comm; } else { comm = "There are no other stories by " + authorLink(username) + " at this time."; } comm += "\n\nThis list was automatically generated by HFYBotReborn version " + Program.version + ". Please contact " + botmailLink("KaiserMagnus") + " or " + botmailLink("j1xwnbsr") + " if you have any queries. This bot is [open source](https://github.com/waitingtocompile/HFYBotReborn)."; return(comm); }