-
Notifications
You must be signed in to change notification settings - Fork 0
/
bot.js
46 lines (34 loc) · 824 Bytes
/
bot.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
41
42
43
44
45
46
console.log('The bot is starting')
var strings
var Twit = require('twit');
var markov = require('string-markov-js');
var fs = require('fs');
var strings = fs.readFileSync('generated.txt').toString().split("\n");
var count = 0;
var limit = strings.length;
var config = require('./config');
var T = new Twit(config);
tweetIt();
setInterval(tweetIt,1000*10);
function tweetIt(){
var text = strings[count];
console.log(text);
if(count<limit){
count++;
}
var tweet = {
status: text
}
//get() Search by hashtag, location
//post() tweeting!
//stream() continuous connection, @mention auto reply example
T.post('statuses/update', tweet, tweeted);
function tweeted(err, data, response){
if(err){
console.log('Oops, something went wrong');
}
else{
console.log("It worked!");
}
}
}