问题描述
除了发出新的推文而不是回复以外,其他所有方法都可以正常工作,我不确定应该在代码中添加什么以使其直接回复,非常感谢。
var TwitterPackage = require('twitter');
var secret = {
consumer_key: 'xxx',consumer_secret: 'xxx',access_token_key: 'xxx',access_token_secret: 'xxx'
}
var Twitter = new TwitterPackage(secret);
// Call the stream function and pass in 'statuses/filter',our filter object,and our callback
Twitter.stream('statuses/filter',{track: 'xx'},function(stream) {
// ... when we get tweet data...
stream.on('data',function(tweet) {
// print out the text of the tweet that came in
console.log(tweet.text);
//build our reply object
var statusObj = {status: "x@" + tweet.user.screen_name + ",xx"}
//call the post function to tweet something
Twitter.post('statuses/update',statusObj,function(error,tweetReply,response){
//if we get an error print it out
if(error){
console.log(error);
}
//print the text of the tweet we sent out
console.log(tweetReply.text);
});
});
// ... when we get an error...
stream.on('error',function(error) {
//print out the error
console.log(error);
});
});
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)