File tree Expand file tree Collapse file tree 1 file changed +22
-5
lines changed Expand file tree Collapse file tree 1 file changed +22
-5
lines changed Original file line number Diff line number Diff line change @@ -57,11 +57,28 @@ const activationPhrase = "Activate that sucka!";
57
57
function respond ( ) {
58
58
var request = JSON . parse ( this . req . chunks [ 0 ] ) ;
59
59
60
- if ( request . text && request . text === activationPhrase ) {
61
- this . res . writeHead ( 200 ) ;
62
- postMessage ( ) ;
63
- this . res . end ( ) ;
64
- }
60
+ if ( request . text ) {
61
+ if ( request . text === activationPhrase ) {
62
+ body . text = quotes [ getRandomIndex ( quotes ) ] ;
63
+ this . res . writeHead ( 200 ) ;
64
+ postMessage ( ) ;
65
+ this . res . end ( ) ;
66
+ }
67
+
68
+ if ( request . text . includes ( "er" ) ) {
69
+ body . text = hardlyKnowHer ( request . text ) ;
70
+ this . res . writeHead ( 200 ) ;
71
+ postMessage ( ) ;
72
+ this . res . end ( ) ;
73
+ }
74
+
75
+ if ( request . text . includes ( '"' ) ) {
76
+ body . text = quotify ( request . text ) ;
77
+ this . res . writeHead ( 200 ) ;
78
+ postMessage ( ) ;
79
+ this . res . end ( ) ;
80
+ }
81
+ }
65
82
}
66
83
67
84
function getRandomIndex ( arr ) {
You can’t perform that action at this time.
0 commit comments