-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.js
executable file
·147 lines (106 loc) · 3.75 KB
/
index.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
#!/usr/bin/env node
var vorpal = require('vorpal')();
var excuses = require('./store/excuses');
var reaction = require('./store/counter');
var compliments = require('./store/compliments');
var gifts = require('./store/gifts');
var proposes = require('./store/proposes');
var survives = require('./store/survives');
var ideas = require('./store/ideas');
var counselors = require('./store/ideas');
var love = require('./lib/love_count');
var chalk = require('chalk');
var emoji = require('node-emoji');
var ascii_art = require('./lib/ascii_art');
// Excuse command
vorpal
.command('excuse', 'Best excuses to get out of relationship')
.action(function(args, callback) {
var excuse = excuses[getRandomInt(0, excuses.length)];
this.log(' ');
this.log(emoji.emojify(':broken_heart: :broken_heart: '), chalk.yellow(excuse));
this.log(' ');
callback();
});
// Reaction command
vorpal
.command('reaction', 'Reaction for dummies who got dumped.')
.action(function(args, callback) {
var excuse = reaction[getRandomInt(0, reaction.length)];
this.log(' ');
this.log(emoji.emojify(':raised_hands: :raised_hands: '), chalk.yellow(excuse));
this.log(' ');
callback();
});
// Compliment command
vorpal
.command('compliment', 'Say something nice and save your ass.')
.action(function(args, callback) {
var compliment = compliments[getRandomInt(0, compliments.length)];
this.log(' ');
this.log(emoji.emojify(':heart_eyes_cat: :heart_eyes_cat: '), chalk.yellow(compliment));
this.log(' ');
callback();
});
// Gifts command
vorpal
.command('gift', 'Give something nice and save your ass.')
.action(function(args, callback) {
var gift = gifts[getRandomInt(0, gifts.length)];
this.log(' ');
this.log(emoji.emojify(':heart_eyes_cat: :heart_eyes_cat: '), chalk.yellow(gift));
this.log(' ');
callback();
});
// Propose command
vorpal
.command('propose', 'Stop being shy and hit it hard.')
.action(function(args, callback) {
var propose = proposes[getRandomInt(0, proposes.length)];
this.log(' ');
this.log(emoji.emojify(':heart_eyes_cat: :heart_eyes_cat: '), chalk.yellow(propose));
this.log(' ');
callback();
});
// Survive command
vorpal
.command('survive', 'Get out of your shell and fight it.')
.action(function(args, callback) {
var survive = survives[getRandomInt(0, survives.length)];
this.log(' ');
this.log(emoji.emojify(':heart_eyes_cat: :heart_eyes_cat: '), chalk.yellow(survive));
this.log(' ');
callback();
});
// Idea command
vorpal
.command('idea', 'Feeling out of luck. Well, Hope you are lucky!')
.action(function(args, callback) {
var idea = ideas[getRandomInt(0, survives.length)];
this.log(' ');
this.log(emoji.emojify(':heart_eyes_cat: :heart_eyes_cat: '), chalk.yellow(idea));
this.log(' ');
callback();
});
// Counselor command
vorpal
.command('counselor', 'Feeling depressed? Meet professionals.')
.action(function(args, callback) {
var counselor = counselors[getRandomInt(0, survives.length)];
this.log(' ');
this.log(emoji.emojify(':heart_eyes_cat: :heart_eyes_cat: '), chalk.yellow(counselor));
this.log(' ');
callback();
});
// Load Ascii birds art
ascii_art.birds();
// Integrate help description.
vorpal.find('exit').description('Exits lovebird.');
// Execute REPL
vorpal
.delimiter(chalk.bold.green('lovebird$'))
.show();
// Generate ranged number
function getRandomInt(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}