1
|
|
|
'use strict'; |
2
|
|
|
|
3
|
|
|
class Module { |
4
|
|
|
constructor() { |
5
|
|
|
//all different commands |
6
|
|
|
this.commands = ["/catchPhrase", "/joke", "/asci", '/random', "/quote"]; |
7
|
|
|
|
8
|
|
|
//all catchPhrases |
9
|
|
|
this.catchPhrase = ["Bernie, the bolt!", "Ooh, you are awful ... but I like you!", |
10
|
|
|
"You might very well think that; I couldn't possibly comment", |
11
|
|
|
"You stupid boy", "Here's Johnny", "Legendary"]; |
12
|
|
|
//all jokes |
13
|
|
|
this.joke = ["I Googled how to start a wildfire. \n I got 48,500 matches.", |
14
|
|
|
"What’s the biggest pan in the world? \n Japan."]; |
15
|
|
|
//all asci |
16
|
|
|
this.asci = ["(╯°□°)╯︵ ┻━┻", "┌∩┐(◣_◢)┌∩┐", "¯(ツ)_/¯", "༼ つ ◕_◕ ༽つ", |
17
|
|
|
"ಠ_ರೃ", "{ o }===(:::)", "︻デ┳═ー", "ᶠᶸᶜᵏ♥ᵧₒᵤ", "♪┏(°.°)┛┗(°.°)┓┗(°.°)┛┏(°.°)┓ ♪"]; |
18
|
|
|
this.quote = ["Life can only be understood backwards; but it must be lived forwards.", |
19
|
|
|
"Beware the barrenness of a busy life.", |
20
|
|
|
"If you try, you risk failure. If you don’t, you ensure it.", |
21
|
|
|
"Life is a spell so exquisite that everything conspires to break it.", |
22
|
|
|
"If you do what you need, you’re surviving. If you do what you want, you’re living.", |
23
|
|
|
"Go confidently in the direction of your dreams. Live the life you have imagined.", |
24
|
|
|
"Live today, for tomorrow it will all be history."]; |
25
|
|
|
} |
26
|
|
|
|
27
|
|
|
getCheckCommand(message) { |
28
|
|
|
let ret = message; |
29
|
|
|
|
30
|
|
|
if (this.commands.indexOf(ret) > -1) { |
31
|
|
|
console.log(ret + ' in commands'); |
|
|
|
|
32
|
|
|
switch (ret) { |
|
|
|
|
33
|
|
|
case '/catchPhrase': |
34
|
|
|
ret = this.getCatchPrase(); |
35
|
|
|
break; |
36
|
|
|
case '/joke': |
37
|
|
|
ret = this.getJoke(); |
38
|
|
|
break; |
39
|
|
|
case '/asci': |
40
|
|
|
ret = this.getAsci(); |
41
|
|
|
break; |
42
|
|
|
case '/quote': |
43
|
|
|
ret = this.getQuote(); |
44
|
|
|
break; |
45
|
|
|
} |
46
|
|
|
} |
47
|
|
|
return ret; |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
getCatchPrase() { |
51
|
|
|
let size = this.getCatchPraseSize(); |
52
|
|
|
|
53
|
|
|
return this.catchPhrase[Math.floor(Math.random()*size)]; |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
getCatchPraseSize() { |
57
|
|
|
return this.catchPhrase.length; |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
getJoke() { |
61
|
|
|
let size = this.getJokeSize(); |
62
|
|
|
|
63
|
|
|
return this.joke[Math.floor(Math.random()*size)]; |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
getJokeSize() { |
67
|
|
|
return this.joke.length; |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
getAsci() { |
71
|
|
|
let size = this.getAsciSize(); |
72
|
|
|
|
73
|
|
|
return this.asci[Math.floor(Math.random()*size)]; |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
getAsciSize() { |
77
|
|
|
return this.asci.length; |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
getQuote() { |
81
|
|
|
let size = this.getQuoteSize(); |
82
|
|
|
|
83
|
|
|
return this.quote[Math.floor(Math.random()*size)]; |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
getQuoteSize() { |
87
|
|
|
return this.quote.length; |
88
|
|
|
} |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
module.exports = Module; |
92
|
|
|
|