问题
I'm trying to write a script to reply to a tweet, using the twit
npm module. However whenever I pass the in_reply_to_status_id_str
or in_reply_to_status_id
this seems to be ignored. Not sure what the issue is?
T.get('search/tweets', { q: `golf since:2011-07-11`, count: 1 }).then(function (response) {
const userName = response.data.statuses[0].user.screen_name;
const tweetId = response.data.statuses[0].id_str;
T.post('statuses/update', { in_reply_to_status_id_str: tweetId, status: `@${userName}, I like golf too` }, (err, data, response) => {
resolve()
})
})
})
回答1:
You should be passing the param as in_reply_to_status_id
instead of in_reply_to_status_id_str
.
T.get('search/tweets', { q: `golf since:2011-07-11`, count: 1 }).then(function (response) {
const userName = response.data.statuses[0].user.screen_name;
const tweetId = response.data.statuses[0].id_str;
T.post('statuses/update', { in_reply_to_status_id: tweetId, status: `@${userName}, I like golf too` }, (err, data, response) => {
resolve()
})
})
})
来源:https://stackoverflow.com/questions/54729379/twitter-api-reply-to-tweet