/
lol.js
328 lines (313 loc) · 15.4 KB
/
lol.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
// a bot that will reply to tweets with placeholder text
// thanks to Imogen Wentworth for the awesome tutorial at http://imogenation.net/building-a-node-js-twitter-bot/
var ntwitter = require("ntwitter");
var auth = require("./auth");
var lol = new ntwitter(auth);
// Get a random element from an array
function getRandIndex(array) {
var index = Math.floor(array.length*Math.random());
return array[index];
}
// get nope
function getNope() {
nopes = [
" Nope.",
" Nope, nope, nope.",
" I'll only reply to cat, bacon, hipster, space, yoga, swol, taco bell, and doge k.",
" Busy now, bye!",
" LOL as if.",
" Maybe later.",
" Meh. Come back later.",
" Gah no.",
" You can't make me.",
" I said goodby, sir!",
" By your command.",
" My alignment is chaotic good. Wait, what were you saying?",
" zzzZZZzzzZZZZzzz",
" zzz",
" Sleeping, bye.",
" I don't know that one, but how are you?",
" Sorry, I was distracted by how good looking my creator is. #notsorry",
" Sigh.",
" Nah.",
" Don't feel like it. Tell me a joke instead.",
" Ohai!",
" Meh."
];
var nope = getRandIndex(nopes);
return nope;
}
// get a catipsum
function getRandCatIpsum() {
catipsums = [
" Lick butt destroy couch, so kick up litter chase imaginary bugs chew foot sun bathe, for stare at ceiling. Intently sniff.",
" Run in circles cat goes crazy, and i like big cats and i cannot lie bathe private parts with tongue then lick owner's face.",
" Climb leg cat snacks, or lick butt climb leg, or stand in front of the computer screen destroy couch have secret plans.",
" Stand in front of the computer screen run in circles kick up litter. Hunt anything that moves swat at dog, present belly.",
" Stare at ceiling stand in front of the computer screen leave fur on owners clothes, so play time, rub face on everything.",
" Nap all day swat at dog favor packaging over toy leave fur on owners clothes hunt anything that moves, climb leg scamper.",
" Throw up on your pillow stare at ceiling cat goes crazy hopped up on catnip, cheeseburgers. Human slave food dispenser.",
" Give attitude kick up litter flop over claw drapes, and throwup on your pillow, and stand in front of the computer screen.",
" Inspect anything brought into the house chew foot, need to chase tail, and flop over, leave fur on owners clothes."
];
var catipsum = getRandIndex(catipsums);
return catipsum;
}
// get a baconipsum
function getRandBaconIpsum() {
baconipsums = [
" Bacon ipsum dolor sit amet pork loin pork t-bone swine cow corned beef tongue spare ribs ground round. Meatloaf, leberkas.",
" Pork loin ham pig meatloaf sirloin biltong jowl kevin. Pastrami jerky andouille ham, ball tip rump salami venison chuck.",
" Pastrami corned beef boudin tenderloin. Ground round pork loin, spare ribs andouille beef. Turkey spare ribs pork chop.",
" Spare ribs. Tenderloin prosciutto turducken, andouille biltong ground round. Bacon drumstick sausage hamburger beef ribs.",
" Pork loin swine leberkas ham hock, drumstick strip steak capicola pork chop beef ribs. Bresaola pork loin meatloaf, jerky."
];
var baconipsum = getRandIndex(baconipsums);
return baconipsum;
}
// get a hipsteripsum
function getRandHipsterIpsum() {
hipsteripsums = [
" Viral irony yr, chambray gastropub literally gentrify ugh Carles lo-fi. Carles banjo cliche, freegan gluten-free.",
" Polaroid gastropub four loko Truffaut swag, pop-up raw denim 3 wolf moon sustainable mlkshk cardigan mixtape viral 90's.",
" Put a bird on it semiotics distillery, ugh plaid blog polaroid drinking vinegar Blue Bottle Williamsburg photo booth.",
" Etsy kogi fashion axe, 90's umami synth asymmetrical. IPhone selfies Brooklyn actually lomo. Portland freegan loko art.",
" Typewriter chia chillwave kitsch, actually meh gluten-free fanny pack chambray raw denim. Kogi post-ironic food truck."
];
var hipsteripsum = getRandIndex(hipsteripsums);
return hipsteripsum;
}
// get a spaceipsum
function getRandSpaceIpsum() {
spaceipsums = [
" Here men from the planet Earth first set foot upon the Moon. July 1969. We came in peace for all mankind. Man must explore. ",
" Houston, Tranquillity Base here. The Eagle has landed. That's one small step for [a] man, one giant leap for mankind.",
" As we got further and further away, it [the Earth] diminished in size. Finally it shrank to the size of a marble.",
" Space, the final frontier. These are the voyages of the Starship Enterprise. Its mission: to explore strange new worlds.",
" Mankind, let us preserve and increase this beauty, and not destroy it! Houston, Tranquillity Base here. The Eagle has landed."
];
var spaceipsum = getRandIndex(spaceipsums);
return spaceipsum;
}
// get a yogaipsum
function getRandYogaIpsum() {
yogaipsums = [
" A thin, round flat bread. abhyantara an incarnation of god. bhujanga vedha chapatti chit kundalini garland pose.",
" Agnistambhasana pose ashwini bund cock pose. easy breath energy center in the heart region, fourth of the seven chakras.",
" Bhagvad gita brahmin collecting. contentment, one of the five niyamas, second of the eight stages of classic yoga.",
" A breathing technique which produces a light sonorous sound. People living together, teaching or learning yogic tradition.",
" A language used in of yoga, hinduism and buddhism, and an official languages of india, considered “historical”."
];
var yogaipsum = getRandIndex(yogaipsums);
return yogaipsum;
}
// get a bsniiipsum
function getRandBsniiIpsum() {
bsniiipsums = [
" B'snii chickabii d'sde chicka'shnii.",
" B'snii chickabii d'sde. B'snii chickabii d'sde. B'snii chickabii, b'snii chicka'shnii. B'snii chickabna d'stamii.", // evil'snii >:)
" Lorem ipsum dolor b'snii chickabii d'stamana chickabana d'stashnii.",
" B'snii chickabii d'sde. B'snii chickabii d'sde. B'snii chickabii, b'snii chicka'shnii. B'snii chickabii d'sde.",
" B'snii chickabii chicka'shnii!"
];
var bsniiipsum = getRandIndex(bsniiipsums);
return bsniiipsum;
}
// get a swolipsum
function getRandSwolIpsum() {
swolipsums = [
" Swol bouldering canyoning carabiner harness chalk bag. Five ten crash pad rope lead climber ascend sport climbing belay.",
" Pole lumberjack chalk bag rope atc crash pad five ten harness ascend downclimb lead mountaineering, deep water soloing.",
" Bouldering swol free solo lead climbing tree fall factor, parkour anchors indoor holds ice shoes chalk bag clif bar.",
" Top roping crash pad jug pocket patagonia hiking spotting cliff. Altitude sickness atc belay carabiner hang-dogging.",
" Crash pad belay crux deep water soloing. Dyno figure eight flute grigri crimp pocket, approach side pull slab wolf moon."
];
var swolipsum = getRandIndex(swolipsums);
return swolipsum;
}
// get a tacobellipsum
function getRandTacoBellIpsum() {
tacobellipsums = [
" Taco bell cantina power, taco. Breakfast burrito fourthmeal spicy fresco why pay more pico de gallo chicken bowl.",
" A.M. Mountain dew toppings breakfast menu 350 calories. Grande scrambler cinnamon twists small price? Cheesy nachos.",
" Cheesy gordita crunch 7-layer burrito brownie sandwich, nachos supreme. Nacho cheese doritos loco taco supreme soft taco.",
" Double decker taco supreme cantina power burrito! Chalupa supreme caramel, fiesta taco salad mtn dew baja blast freeze.",
" Crunchy taco supreme meximelt? Cheese roll-up chalupa supreme dr pepper vanilla float freeze. Fiesta taco salad churros."
];
var tacobellipsum = getRandIndex(tacobellipsums);
return tacobellipsum;
}
// get a dogeipsum
function getRandDogeIpsum() {
dogeipsums = [
" wow. many text. such HTML. very placeholder. lorem graphic. very filler. lorem generator. so text. much generator.",
" so typography. so filler. much generator. such generator. many github. many HTML. lorem ipsum. so text. such graphic.",
" very graphic. very layout. so javascript. much dogescript. so doge. many HTML. lorem dogescript. lorem doge. lorem graphic.",
" very graphic. very layout. so javascript. much dogescript. so doge. many HTML. lorem dogescript. lorem doge. lorem graphic.",
" many HTML. many layout. very graphic. very typography. much text. much placeholder. very HTML. much github. wow."
];
var dogeipsum = getRandIndex(dogeipsums);
return dogeipsum;
}
// get a hodoripsum
function getRandHodorIpsum() {
hodoripsums = [
" Hodor, hodor hodor hodor hodor; hodor hodor. Hodor? Hodor hodor hodor hodor. Hodor! Hodor hodor hodor, hodor.",
" Hodor hodor hodor, hodor hodor! Hodor, hodor... Hodor? Hodor hodor hodor. Hodor! Hodor hodor hodor, hodor hodor.",
" Hodor!! Hodor hodor, hodor hodor. Hodor hodor hodor; HODOR hodor hodor. Hodor? Hodor hodor hodor, hodor hodor.",
" Hodor Hodor hodor hodor hodor... Hodor hodor hodor! Hodor hodor hodor hodor. Hodor hodor hodor hodor hodor hodor.",
" Hodor Hodor hodor HODOR hodor; hodor hodor hodor. Hodor hodor hodor hodor. Hodor. Hodor, hodor hodor hodor. Hodor?"
];
var hodoripsum = getRandIndex(hodoripsums);
return hodoripsum;
}
// get a zeldaipsum
function getRandHylianIpsum() {
hylianipsums = [
" A link to the past kokiri forest lost woods, jabu-jabu. Adventures of link mini-dungeon kokiri sword hylian shield cuccos.",
" Deku escort fireball dungeon lava triforce sheik ocarina of time bazaar big bomb bag quiver big skulltul, king of thieves.",
" Wolfos titan's mitt temple of time zora. Zora's fountain, rupees treasure chest piece of heart megaton hammer magic jar.",
" Lon lon milk mirror shield, navi pegasus boots. Odd potion octorok skill mask magic meter magic cape majora's mask boss key.",
" Book of mudora ganon boss key goron deku stick. Din's fire fairy bottle gerudo ganondorf link zelda hyrule, deku seeds.",
" Deku escort fireball dungeon lava triforce. Sheik ocarina of time bazaar big bomb bag quiver big skulltul, king of thieves.",
" House of know-it-all brothers hero of time iron boots ice rod, Like-like lon lon ranch miniboss arrghus biggest bomb bag."
];
var hylianipsum = getRandIndex(hylianipsums);
return hylianipsum;
}
// get a zeldaipsum
function getRandBeerIpsum() {
beeripsums = [
" Hoppy grainy cold filter cask, bottom fermenting yeast trappist lagering. Bottle conditioning attenuation, cask priming.",
" Krausen fermentation priming biere de garde grainy. Goblet bung, fermentation beer barleywine pitching dunkle chocolate.",
" Hop back hops hydrometer hop back hand pump enzymes bright beer wit berliner weisse. saccharification, chocolate malt.",
" Scotch ale finishing hops, bottom fermenting yeast infusion, brew. Autolysis dry stout beer caramel malt carbonation?",
" Hefe acidic conditioning secondary fermentation hard cider krug top-fermenting yeast pub conditioning tank bitter."
];
var beeripsum = getRandIndex(beeripsums);
return beeripsum;
}
// Log errors
var callback = function handleError(error) {
if (error) {
console.error("response status:", error.statusCode);
console.error("data:", error.data);
}
};
// Array to store streamed tweets
// var queue = [];
// Get a stream of Tweets
function startStreaming() {
lol.stream("statuses/filter", { track: "@lolem_ipsum" }, function(stream) {
console.log("Listening for Tweets...");
stream.on("data", function(tweet) {
// Check Tweet for specific matching phrases as Twitter's Streaming API doesn't allow for this
if (tweet.text.match("cat")) {
var catText = getRandCatIpsum();
var catParams = {
status: "@" + tweet.user.screen_name + catText,
in_reply_to_status_id: tweet.id_str
};
console.log(tweet.text);
lol.updateStatus(catParams, catParams, callback);
} else if(tweet.text.match("bacon")) {
var baconText = getRandBaconIpsum();
var baconParams = {
status: "@" + tweet.user.screen_name + baconText,
in_reply_to_status_id: tweet.id_str
};
console.log(tweet.text);
lol.updateStatus(baconParams, baconParams, callback);
} else if(tweet.text.match("hipster")) {
var hipsterText = getRandHipsterIpsum();
var hipsterParams = {
status: "@" + tweet.user.screen_name + hipsterText,
in_reply_to_status_id: tweet.id_str
};
console.log(tweet.text);
lol.updateStatus(hipsterParams, hipsterParams, callback);
} else if(tweet.text.match("space")) {
var spaceText = getRandSpaceIpsum();
var spaceParams = {
status: "@" + tweet.user.screen_name + spaceText,
in_reply_to_status_id: tweet.id_str
};
console.log(tweet.text);
lol.updateStatus(spaceParams, spaceParams, callback);
} else if(tweet.text.match("yoga")) {
var yogaText = getRandYogaIpsum();
var yogaParams = {
status: "@" + tweet.user.screen_name + yogaText,
in_reply_to_status_id: tweet.id_str
};
console.log(tweet.text);
lol.updateStatus(yogaParams, yogaParams, callback);
} else if(tweet.text.match("b'snii")) {
var bsniiText = getRandBsniiIpsum();
var bsniiParams = {
status: "@" + tweet.user.screen_name + bsniiText,
in_reply_to_status_id: tweet.id_str
};
console.log(tweet.text);
lol.updateStatus(bsniiParams, bsniiParams, callback);
} else if(tweet.text.match("swol")) {
var swolText = getRandSwolIpsum();
var swolParams = {
status: "@" + tweet.user.screen_name + swolText,
in_reply_to_status_id: tweet.id_str
};
console.log(tweet.text);
lol.updateStatus(swolParams, swolParams, callback);
} else if(tweet.text.match("taco bell")) {
var tacoBellText = getRandTacoBellIpsum();
var tacoBellParams = {
status: "@" + tweet.user.screen_name + tacoBellText,
in_reply_to_status_id: tweet.id_str
};
console.log(tweet.text);
lol.updateStatus(tacoBellParams, tacoBellParams, callback);
} else if(tweet.text.match("doge")) {
var dogeText = getRandDogeIpsum();
var dogeParams = {
status: "@" + tweet.user.screen_name + dogeText,
in_reply_to_status_id: tweet.id_str
};
console.log(tweet.text);
lol.updateStatus(dogeParams, dogeParams, callback);
} else if(tweet.text.match("hodor")) {
var hodorText = getRandHodorIpsum();
var hodorParams = {
status: "@" + tweet.user.screen_name + hodorText,
in_reply_to_status_id: tweet.id_str
};
console.log(tweet.text);
lol.updateStatus(hodorParams, hodorParams, callback);
} else if(tweet.text.match("zelda")) {
var hylianText = getRandHylianIpsum();
var hylianParams = {
status: "@" + tweet.user.screen_name + hylianText,
in_reply_to_status_id: tweet.id_str
};
console.log(tweet.text);
lol.updateStatus(hylianParams, hylianParams, callback);
} else if(tweet.text.match("beer")) {
var beerText = getRandBeerIpsum();
var beerParams = {
status: "@" + tweet.user.screen_name + beerText,
in_reply_to_status_id: tweet.id_str
};
console.log(tweet.text);
lol.updateStatus(beerParams, beerParams, callback);
} else {
var nopeText = getNope();
var nopeParams = {
status: "@" + tweet.user.screen_name + nopeText,
in_reply_to_status_id: tweet.id_str
};
console.log(tweet.text);
lol.updateStatus(nopeParams, nopeParams, callback);
}
});
});
}
startStreaming();