节点回复推文实际上没有回复

时间:2016-07-05 08:40:09

标签: node.js twitter bots

我正在使用Twit节点库来回复流中的推文,虽然它完美地工作,但推文回复并未在时间轴上显示为回复,相反,它显示为独立的推文,与以前的谈话无关。

这是我的代码:

function tweetEvent(eventMsg) {
    var replyto = eventMsg.in_reply_to_screen_name;
    var text = eventMsg.text;
    var from = eventMsg.user.screen_name;

    console.log(replyto + ' ' + from);

    if( (text.indexOf('myhandle') >= 0) || (from != 'myhandle')) {
        var reply = replies[Math.floor(Math.random() * replies.length)];
        var newtweet = '@' + from + ' ' + reply;
        tweetIt(newtweet);
    }
}

function tweetIt(txt) {

    var tweet = {
      status: txt
    }

    T.post('statuses/update', tweet, tweeted);

    function tweeted(err, data, response) {
      if (err) {
        console.log("Something went wrong!");
      } else {
        console.log("It worked!");
      }
    }
}

1 个答案:

答案 0 :(得分:0)

为了使用Twitter API在时间轴中显示回复,您需要以下内容:

<Product Id="*"
       Name="$(var.PRODUCTNAME)"
       Language="1033"
       Version="$(var.PRODUCTVERSION)"
       Manufacturer="Manufacturer"
       UpgradeCode="UPGRADE_CODE"
       >
<Package InstallerVersion="200"
         Compressed="yes"
         InstallScope="perMachine" />

<MajorUpgrade Schedule="afterInstallInitialize"
              AllowDowngrades="no"
              AllowSameVersionUpgrades="no"
              DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate EmbedCab="yes" />

还需要app.directive('mydirective', function() { return { restrict: 'A', link: function($scope, element, attrs) { var links = element.find('li'); links.on('click', function(e) { if ($('.navbar-toggle').css('display') != 'none') { $(".navbar-toggle").trigger("click"); } }); } }; 中的参数// the status update or tweet ID in which we will reply var nameID = eventMsg.id_str; 。请参阅下面的代码更新,它现在应该保留对话:

in_reply_to_status_id