ttezel / twit

Twitter API Client for node (REST & Streaming API)
4.31k stars 568 forks source link

Auto like any retweets #476

Open ksjapanstore opened 6 years ago

ksjapanstore commented 6 years ago

Does Twit have the ability to like the retweet?

slippyex commented 6 years ago

They implicitly have it ... you just need to code it for yourself ...

Here's a snippet for how I did it ...

...
...
    for (let tweet of tweets) {
      log.debug(tweet.text, {user: tweet.user.name, tweet_id: tweet.id_str});
      try {
        await T.post('statuses/retweet/' + tweet.id_str, {});
        // check, if we also want to auto-like the tweet
        if (search.auto_like) {
          await T.post('favorites/create', {id: tweet.id_str}, {});
        }
...
...

Hope this helps ...