-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
76 lines (65 loc) · 2.21 KB
/
app.js
File metadata and controls
76 lines (65 loc) · 2.21 KB
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
const Twitter = require('twitter');
const config = require('./config.js');
const T = new Twitter(config);
const mytweet0 ={
status:'Books prescribed for #Softwareengineers at #Samvit. 8) Code Complete: A Practical Handbook of Software Construction Steve McConnell #books #software'
}
const mytweet1 ={
status:'Books prescribed for #Softwareengineers at #Samvit. 9) The Pragmatic Programmer: From Journeyman to Master Andrew Hunt #books #software'
}
const mytweet2 ={
status:'Books prescribed for #Softwareengineers at #Samvit. 10) Structure and Interpretation of Computer Programs Harold Abelson #books #software'
}
const mytweet3 ={
status:'Books prescribed for #Softwareengineers at #Samvit. 11) Refactoring: Improving the Design of Existing Code Martin Fowler #books #software'
}
const mytweet4 ={
status:'Books prescribed for #Softwareengineers at #Samvit. 12) Clean Code: A Handbook of Agile Software Craftsmanship Robert C Martin #books #software'
}
const mytweet5 ={
status:'Books prescribed for #Softwareengineers at #Samvit. 13) Programming Pearls (2nd Edition) Jon Bentley #books #software'
}
const mytweet6 ={
status:'Books prescribed for #Softwareengineers at #Samvit. 14) Code: The Hidden Language of Computer Hardware and Software Charles Petzold #books #software'
}
var currentDayNumber = require('current-day-number');
//var currentHour = require('hours');
console.log('Current Day Number '+currentDayNumber());
var cd = currentDayNumber()%7;
var mytweet=mytweet0;
if(cd == 0){
console.log('In d0');
mytweet = mytweet0;
}
else if(cd == 1){
console.log('In d1');
mytweet = mytweet1;
}
else if(cd == 2){
console.log('In d2');
mytweet = mytweet2;
}
else if(cd == 3){
console.log('In d3');
mytweet = mytweet3;
}
else if(cd == 4){
console.log('In d4');
mytweet = mytweet4;
}
else if(cd == 5){
console.log('In d5');
mytweet = mytweet5;
}
else {
console.log('In d6');
mytweet = mytweet6;
}
console.log('Tweet is '+mytweet.status);
T.post('statuses/update', mytweet, (err, response) => {
if(err){
return console.log('Post failed : '+err[0].message);
}
const username = response.user.screen_name;
console.log(`Your name:`+username);
});