-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
58 lines (40 loc) · 1.65 KB
/
server.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
47
48
49
50
51
52
53
54
55
var fs = require('fs'),
path = require('path'),
Twit = require('twit'),
config = require(path.join(__dirname, 'config.js'));
// ----- my scripts ----
var d= new Date();
var h = d.getHours();
var m = d.getMinutes();
var time = h*60 + m;
checkTime(time);
function checkTime(time){
console.log(time);
if(time >= 420 && time <= 450){
var status = "Ajit Mijar | Unjusticed for " + dateCalculator("07/14/2016") + " Days #JusticeForAjit #IntercasteMarriage #StopCasteDiscrimination #TwitterBot";
tweetUpdates(status);
}
else if(time >= 600 && time <= 630){
var status = "Navaraj BK, Ganesh Budha , Sandip BK , Lokendra Sunar , Govinda Shahi , Tikaram Sunar | Unjusticed for , " + dateCalculator("05/24/2020") + " Days #StopCasteDiscrimination #TwitterBot";
tweetUpdates(status);}
else if(time >= 1200 && time <= 1230 ){
var status = "Nirmala Panta | Unjusticed for " + dateCalculator("07/27/2018") + " Days #JusticeForNirmala #RapeAndMurder #KillRapist #TwitterBot";
tweetUpdates(status);}
else { console.log("No Tweets Now !!");}
}
function tweetUpdates(status){
var T = new Twit(config);
T.post('statuses/update', { status: status}, function(err, data, response) {
console.log(data)
});
}
function dateCalculator(d){
var date1 = new Date(d);
var today = new Date();
var date2 = today;
console.log(date2);
var Difference_In_Time = date2.getTime() - date1.getTime();
var Difference_In_Days = Difference_In_Time / (1000 * 3600 * 24);
return parseInt(Difference_In_Days+1);
}
// --- myscripts end ----