Reputation: 1
// 1. /*Authentication */
TwitterCredentials.SetCredentials("", "", "", "");
var tweets = SearchJson.SearchTweets("@Kaanshu7");
var js = new JavaScriptSerializer();
var tweetsSerialize = js.Deserialize<dynamic>(tweets);
var text = tweetsSerialize["statuses"][0]["text"];
bool isAvailable = text.Contains("#ServiceRequest");
if (isAvailable)
{
tweet = text;
tweet_id = tweetsSerialize["statuses"][0]["id"];
// 2. /*Here trying to Retweet (not posting)*/
retweet = Console.ReadLine();
var ReplyTweet = Tweet.CreateTweet(retweet);
var replyTweet = Tweet.PublishTweetInReplyTo(ReplyTweet, tweet_id);
}
Upvotes: 0
Views: 754
Reputation: 39
It seems that the twitter API changed, and to reply tweets with tweetinv, you need to do that:
var tweet = Search.SearchTweets("stackoverflow");
var textToPublish = $"@{tweet.CreatedBy.ScreenName}";
var reply = Tweet.PublishTweet(new PublishTweetParameters(textToPublish)
{
InReplyToTweet = tweet
});
Upvotes: 0
Reputation: 595
why is your code so complex when it could be as east as the following:
var tweets = Search.SearchTweets("@Kaanshu7");
var firstTweet = tweets.First();
bool isAvailable = firstTweet.Text.Contains("#ServiceRequest");
if (isAvailable)
{
var retweetMessage = Console.ReadLine();
firstTweet.PublishReply(retweetMessage);
}
Easier don't you think?
Upvotes: 2