private static void TwitterMode() { var twitter = new Twitter(_config, _log); // TODO split this into Twitter.Functions() if (twitter.GetRemainingRequests() > 0) { var markov = new Markov(_log); var timeline = twitter.GetStatuses(); if (timeline.Count == 0) { _log.Write("Couldn't fetch any tweet, exiting..."); return; } foreach (var tweet in timeline) { markov.AddSentence(tweet); } // either post a tweet or write X tweets to a file var writeFile = _config.GetBoolValue(ConfigKeys.Preferences_Local); var forceLastWord = _config.GetBoolValue(ConfigKeys.Preferences_ForceLastWord); if (writeFile) { var generatedTweets = new List <string>(); for (var i = 0; i < 1000; i++) { generatedTweets.Add(markov.GenerateSentence(220, forceLastWord)); } var filePath = Directory.GetCurrentDirectory() + @"\tweets.txt"; File.AppendAllLines(filePath, generatedTweets); _log.Write($"Generated tweets written at {filePath}."); } else { twitter.PostTweet(markov.GenerateSentence(250, forceLastWord)); } } }