forked from Aldevetz/bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtweet.js
42 lines (34 loc) · 1.06 KB
/
tweet.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
var Twitter = require('twitter');
var https = require('https');
var request = require('request');
var querystring = require('querystring');
var search_query = '';
var client = new Twitter({
consumer_key: '',
consumer_secret: '',
access_token_key: '',
access_token_secret: ''
});
client.get('search/tweets', { q: search_query }, function(error, tweets, response){
if (!error) {
var message = '';
tweets.statuses.forEach(function (val, index, ar) {
var url = 'https://twitter.com/' + val.user.screen_name + '/status/' + val.id_str;
message += url + "\n";
});
var options = {
hostname: 'typetalk.in',
path: '',
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
};
var req = https.request(options, function (res) {
res.on('data', function (chunk) {
});
});
req.write(querystring.stringify({'message': message}));
req.end();
}
});