public Message GetTweetMessage(SocialAccount account, long tweetId) { _twitterClient.SetUserCredentials(account.Token, account.TokenSecret); var tweet = _twitterClient.GetTweet(tweetId); if (tweet == null) { return(null); } var message = TwitterConverter.ConvertToMessage(tweet); message.Sender = new SocialUser { Name = tweet.CreatedBy.Name, Avatar = tweet.CreatedBy.ProfileImageUrl, ScreenName = tweet.CreatedBy.ScreenName, OriginalId = tweet.CreatedBy.IdStr, OriginalLink = TwitterHelper.GetUserUrl(tweet.CreatedBy.ScreenName) }; return(message); }
private void BuildTweetTree(ITweet currentTweet, List <ITweet> tweets) { tweets.Add(currentTweet); // for performance reason, we just get 10 parent tweet in the tree. if (tweets.Count >= 10) { return; } if (currentTweet.InReplyToStatusId != null) { ITweet inReplyToTweet = _twitterClient.GetTweet(currentTweet.InReplyToStatusId.Value); if (inReplyToTweet == null) { return; } BuildTweetTree(inReplyToTweet, tweets); } }