Finding the tweetID of a tweet in tweetinvi

前端 未结 2 1986
野性不改
野性不改 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.

提交回复
热议问题