Twitter api 回复推文

Ben*_*ers 3 twitter node.js

我正在尝试使用twitnpm 模块编写一个脚本来回复推文。然而,每当我通过in_reply_to_status_id_strin_reply_to_status_idthis 似乎被忽略。不知道是什么问题?

   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()
            })
          })

        })
Run Code Online (Sandbox Code Playgroud)

rya*_*ack 5

您应该将 param 作为in_reply_to_status_id而不是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()
            })
          })

        })
Run Code Online (Sandbox Code Playgroud)