Finding the tweetID of a tweet in tweetinvi

前端 未结 2 1943
野性不改
野性不改 2021-01-28 07:28

I am relatively new to programming in C# (Learning on my own for a school project) and decided to try using TweetInvi to implement Twitter functionality. So far it\'s going goo

相关标签:
2条回答
  • 2021-01-28 08:09

    You can try something like this:

        public string PublishTweet(string text)
        {
            var appCredentials = new TwitterCredentials(_apiKey,_apiSecret, _accessToken, _accessTokenSecret);
            Tweetinvi.Auth.SetCredentials(appCredentials);
    
            text = "my tweet";
    
            var publishedTweet = Tweetinvi.Tweet.PublishTweet(text);
            var tweetId = publishedTweet.Id.ToString();
    
            return tweetId;
        }
    

    You just need to get the published tweet into a var for the result of the PublishTweet() method then you select the field(s) you need.

    0 讨论(0)
  • 2021-01-28 08:15

    Simple solution. As explained before you need to take the tweet back from PublishTweet.

    string text = "text";
    ITweet tweet = Tweet.PublishTweet(text);
    bool destroySuccess = tweet.Destroy();
    
    0 讨论(0)
提交回复
热议问题