// 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);
}
问问题
699 次
2 回答
2
为什么你的代码如此复杂,因为它可能像下面这样东:
var tweets = Search.SearchTweets("@Kaanshu7");
var firstTweet = tweets.First();
bool isAvailable = firstTweet.Text.Contains("#ServiceRequest");
if (isAvailable)
{
var retweetMessage = Console.ReadLine();
firstTweet.PublishReply(retweetMessage);
}
你不觉得更容易吗?
于 2014-07-21T23:02:23.920 回答
0
似乎 twitter API 发生了变化,要使用 tweetinv 回复推文,您需要这样做:
var tweet = Search.SearchTweets("stackoverflow");
var textToPublish = $"@{tweet.CreatedBy.ScreenName}";
var reply = Tweet.PublishTweet(new PublishTweetParameters(textToPublish)
{
InReplyToTweet = tweet
});
于 2020-04-30T22:17:49.627 回答