Twitter API回复推文

5

我正在尝试使用twit npm模块编写一个回复推文的脚本。然而,每当我传递in_reply_to_status_id_strin_reply_to_status_id时,似乎都会被忽略。不确定问题出在哪里?

   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个回答

6
你应该将参数传递为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()
            })
          })

        })


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接