Exemplo n.º 1
0
 public void tweetTrending()
 {
     trendingTopics = getTrendingTweets();
     string topic   = trendingTopics[rand.Next(0, trendingTopics.Count)];
     string message = String.Format("{0} #{1}", FileMediaGetter.getFileItem("Quotes.txt"), topic);
     var    tweet   = Tweet.PublishTweet(message);
 }
Exemplo n.º 2
0
 public void tweetWithMedia()
 {
     try
     {
         byte[] file  = File.ReadAllBytes(FileMediaGetter.getMedia());
         var    tweet = Tweet.PublishTweetWithImage(FileMediaGetter.getFileItem("Quotes.txt"), file);
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
     }
 }
Exemplo n.º 3
0
        public void replyToUser()
        {
            List <string> users      = searchForTweets();
            string        chosenUser = users[rand.Next(users.Count)];

            if (tweetedUsers.Contains(chosenUser))
            {
                return;
            }
            else
            {
                string message = String.Format("@" + "{0} {1}", chosenUser, FileMediaGetter.getFileItem("Quotes.txt"));
                Console.WriteLine(message);
                var tweet = Tweet.PublishTweet(message);
                tweetedUsers.Add(chosenUser);
            }
        }
Exemplo n.º 4
0
        public List <string> searchForTweets()
        {
            string        searchTerm = FileMediaGetter.getFileItem("SearchTerms.txt");
            var           tweets     = Search.SearchTweets(searchTerm);
            List <string> users      = new List <string>();

            foreach (var tweet in tweets)
            {
                try
                {
                    users.Add(tweet.InReplyToScreenName);
                    Console.WriteLine(tweet);
                }
                catch (Exception exception)
                {
                    Console.WriteLine(exception);
                    continue;
                }
            }
            users.RemoveAll(string.IsNullOrWhiteSpace);
            return(users);
        }