Rishikant181 / Rettiwt-API

A CLI tool and an API for fetching data from Twitter for free!
https://rishikant181.github.io/Rettiwt-API/
MIT License
303 stars 31 forks source link

Added ability to post a reply to a tweet #463

Closed Rishikant181 closed 4 months ago

Rishikant181 commented 4 months ago

A reply can now be posted a tweet using the tweet.tweet method (the same method used to post a tweet), using a third optional parameter, as follows:

import { Rettiwt } from 'rettiwt-api';

// Creating a new Rettiwt instance using the given 'API_KEY'
const rettiwt = new Rettiwt({ apiKey: API_KEY });

// Posting a simple text reply, to a tweet with id "1234567890"
rettiwt.tweet.tweet('Hello!', undefined, "1234567890")
.then(res => {
    console.log(res);
})
.catch(err => {
    console.log(err);
});

The same can be done from CLI using an option -r <target_tweet_id> or --reply <target_tweet_id> while posting a tweet using the post command.

Closes #449 Closes #448