Not sure how to enter in_reply_to_status_id.
This is a subtle statement that simply does not respond to the tweet mentioned in it.
In_reply_to_status_id is part of the Twitter API that Twit accesses, but can I use it in this context?
Any help would be greatly appreciated.
Here is the code:
var stream = T.stream('statuses/filter', { track: '@example'});
io.on('connection', function (socket) {
socket.on('chat message', function (msg) {
console.log('message: ' + msg);
P.post('statuses/update', { status: '@example' + ' ' + msg}, function (err, data, response) {
socket.emit('info', data.text);
socket.emit('userPic', data.user.profile_image_url);
console.log(data.user.profile_image_url);
});
});
stream.start();
stream.on('tweet', function (tweet) {
console.log(tweet);
if (tweet.text.indexOf('@example') > -1) {
console.log("there is a tweet");
var number = Date.now();
var reply = replies[Math.floor(Math.random() * replies.length)];
var name = '@' + tweet.user.screen_name;
T.post('statuses/update', {in_reply_to_status_id: [name], status: reply + ' ' + number + ' ' + name}, function (err, data, response) {
console.log(reply + number);
socket.emit('reply', data.text);
});
}
});
});
source
share