Twitter api回复推文

问题描述 投票:1回答:1

我正在尝试编写一个脚本来回复推文,使用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()
            })
          })

        })
node.js twitter
1个回答
1
投票

你应该把这个参数作为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()
            })
          })

        })
© www.soinside.com 2019 - 2024. All rights reserved.