【问题标题】:Twitter api reply to tweetTwitter api 回复推文
【发布时间】:2019-03-12 10:29:47
【问题描述】:

我正在尝试使用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】:

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

    【讨论】:

      猜你喜欢
      • 2022-10-05
      • 2011-02-11
      • 2013-06-10
      • 2020-11-14
      • 2022-10-05
      • 1970-01-01
      • 2015-09-10
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多