-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIsItRad.js
57 lines (46 loc) · 1.19 KB
/
IsItRad.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
56
57
function isItRad (tweet, radness) {
var Twitter = require('twitter');
var client = new Twitter({
consumer_key: "",
consumer_secret: "",
access_token_key: "",
access_token_secret: "",
});
var tag;
if (radness === "rad") {
tag = "#thatsRad";
}
else if (radness === "notRad") {
tag = "#thatsNotRad";
}
else {
return console.log("you have not entered a radness level.");
}
if (tweet.length > 140) {
return console.log("your tweet is too long at " + tweet.length + " characters");
}
else if ((tweet.length + tag.length)>140) {
client.post("statuses/update", {status: tweet}, function(error, tweet) {
if (!!error) {
console.log(error);
}
else {
console.log("your tweet has been published, but without radness because it was too long");
}
});
}
else {
client.post("statuses/update", {status: tweet + " " + tag}, function(error, tweet) {
if (!!error) {
console.log(error);
}
else {
console.log("your tweet has been published!");
}
});
}
}
console.log(process.argv);
var tweet = process.argv[2];
var radness = process.argv[3];
isItRad(tweet, radness);