-
Notifications
You must be signed in to change notification settings - Fork 3
/
chatbot.js
3458 lines (3411 loc) · 111 KB
/
chatbot.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
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// State
let using_GPT3 = false // otherwise using scripted experience
let currentInput = ''
let previousInput = ''
let previousOutput = ''
let previousOutputs = new Set()
let currentSpirit = null
let questGoals = {
// How many QAs of a certain tag the user must go through before progressing in the questline.
who: 2,
where: 3,
rage: 3
}
let playedJack = false
let completionEffect = null
let possessedMessage = ''
let possessedRound = 10 + Math.round(Math.random() * 20)
let currentRound = 0
let debuggingLogs = []
let testCount = 0
const countryMappings = {"BD": "Bangladesh", "BE": "Belgium", "BF": "Burkina Faso", "BG": "Bulgaria", "BA": "Bosnia and Herzegovina", "BB": "Barbados", "WF": "Wallis and Futuna", "BL": "Saint Barthelemy", "BM": "Bermuda", "BN": "Brunei", "BO": "Bolivia", "BH": "Bahrain", "BI": "Burundi", "BJ": "Benin", "BT": "Bhutan", "JM": "Jamaica", "BV": "Bouvet Island", "BW": "Botswana", "WS": "Samoa", "BQ": "Bonaire, Saint Eustatius and Saba ", "BR": "Brazil", "BS": "Bahamas", "JE": "Jersey", "BY": "Belarus", "BZ": "Belize", "RU": "Russia", "RW": "Rwanda", "RS": "Serbia", "TL": "East Timor", "RE": "Reunion", "TM": "Turkmenistan", "TJ": "Tajikistan", "RO": "Romania", "TK": "Tokelau", "GW": "Guinea-Bissau", "GU": "Guam", "GT": "Guatemala", "GS": "South Georgia and the South Sandwich Islands", "GR": "Greece", "GQ": "Equatorial Guinea", "GP": "Guadeloupe", "JP": "Japan", "GY": "Guyana", "GG": "Guernsey", "GF": "French Guiana", "GE": "Georgia", "GD": "Grenada", "GB": "United Kingdom", "GA": "Gabon", "SV": "El Salvador", "GN": "Guinea", "GM": "Gambia", "GL": "Greenland", "GI": "Gibraltar", "GH": "Ghana", "OM": "Oman", "TN": "Tunisia", "JO": "Jordan", "HR": "Croatia", "HT": "Haiti", "HU": "Hungary", "HK": "Hong Kong", "HN": "Honduras", "HM": "Heard Island and McDonald Islands", "VE": "Venezuela", "PR": "Puerto Rico", "PS": "Palestinian Territory", "PW": "Palau", "PT": "Portugal", "SJ": "Svalbard and Jan Mayen", "PY": "Paraguay", "IQ": "Iraq", "PA": "Panama", "PF": "French Polynesia", "PG": "Papua New Guinea", "PE": "Peru", "PK": "Pakistan", "PH": "Philippines", "PN": "Pitcairn", "PL": "Poland", "PM": "Saint Pierre and Miquelon", "ZM": "Zambia", "EH": "Western Sahara", "EE": "Estonia", "EG": "Egypt", "ZA": "South Africa", "EC": "Ecuador", "IT": "Italy", "VN": "Vietnam", "SB": "Solomon Islands", "ET": "Ethiopia", "SO": "Somalia", "ZW": "Zimbabwe", "SA": "Saudi Arabia", "ES": "Spain", "ER": "Eritrea", "ME": "Montenegro", "MD": "Moldova", "MG": "Madagascar", "MF": "Saint Martin", "MA": "Morocco", "MC": "Monaco", "UZ": "Uzbekistan", "MM": "Myanmar", "ML": "Mali", "MO": "Macao", "MN": "Mongolia", "MH": "Marshall Islands", "MK": "Macedonia", "MU": "Mauritius", "MT": "Malta", "MW": "Malawi", "MV": "Maldives", "MQ": "Martinique", "MP": "Northern Mariana Islands", "MS": "Montserrat", "MR": "Mauritania", "IM": "Isle of Man", "UG": "Uganda", "TZ": "Tanzania", "MY": "Malaysia", "MX": "Mexico", "IL": "Israel", "FR": "France", "IO": "British Indian Ocean Territory", "SH": "Saint Helena", "FI": "Finland", "FJ": "Fiji", "FK": "Falkland Islands", "FM": "Micronesia", "FO": "Faroe Islands", "NI": "Nicaragua", "NL": "Netherlands", "NO": "Norway", "NA": "Namibia", "VU": "Vanuatu", "NC": "New Caledonia", "NE": "Niger", "NF": "Norfolk Island", "NG": "Nigeria", "NZ": "New Zealand", "NP": "Nepal", "NR": "Nauru", "NU": "Niue", "CK": "Cook Islands", "XK": "Kosovo", "CI": "Ivory Coast", "CH": "Switzerland", "CO": "Colombia", "CN": "China", "CM": "Cameroon", "CL": "Chile", "CC": "Cocos Islands", "CA": "Canada", "CG": "Republic of the Congo", "CF": "Central African Republic", "CD": "Democratic Republic of the Congo", "CZ": "Czech Republic", "CY": "Cyprus", "CX": "Christmas Island", "CR": "Costa Rica", "CW": "Curacao", "CV": "Cape Verde", "CU": "Cuba", "SZ": "Swaziland", "SY": "Syria", "SX": "Sint Maarten", "KG": "Kyrgyzstan", "KE": "Kenya", "SS": "South Sudan", "SR": "Suriname", "KI": "Kiribati", "KH": "Cambodia", "KN": "Saint Kitts and Nevis", "KM": "Comoros", "ST": "Sao Tome and Principe", "SK": "Slovakia", "KR": "South Korea", "SI": "Slovenia", "KP": "North Korea", "KW": "Kuwait", "SN": "Senegal", "SM": "San Marino", "SL": "Sierra Leone", "SC": "Seychelles", "KZ": "Kazakhstan", "KY": "Cayman Islands", "SG": "Singapore", "SE": "Sweden", "SD": "Sudan", "DO": "Dominican Republic", "DM": "Dominica", "DJ": "Djibouti", "DK": "Denmark", "VG": "British Virgin Islands", "DE": "Germany", "YE": "Yemen", "DZ": "Algeria", "US": "United States", "UY": "Uruguay", "YT": "Mayotte", "UM": "United States Minor Outlying Islands", "LB": "Lebanon", "LC": "Saint Lucia", "LA": "Laos", "TV": "Tuvalu", "TW": "Taiwan", "TT": "Trinidad and Tobago", "TR": "Turkey", "LK": "Sri Lanka", "LI": "Liechtenstein", "LV": "Latvia", "TO": "Tonga", "LT": "Lithuania", "LU": "Luxembourg", "LR": "Liberia", "LS": "Lesotho", "TH": "Thailand", "TF": "French Southern Territories", "TG": "Togo", "TD": "Chad", "TC": "Turks and Caicos Islands", "LY": "Libya", "VA": "Vatican", "VC": "Saint Vincent and the Grenadines", "AE": "United Arab Emirates", "AD": "Andorra", "AG": "Antigua and Barbuda", "AF": "Afghanistan", "AI": "Anguilla", "VI": "U.S. Virgin Islands", "IS": "Iceland", "IR": "Iran", "AM": "Armenia", "AL": "Albania", "AO": "Angola", "AQ": "Antarctica", "AS": "American Samoa", "AR": "Argentina", "AU": "Australia", "AT": "Austria", "AW": "Aruba", "IN": "India", "AX": "Aland Islands", "AZ": "Azerbaijan", "IE": "Ireland", "ID": "Indonesia", "UA": "Ukraine", "QA": "Qatar", "MZ": "Mozambique"}
function parseLocation(raw) {
let parsed = ''
if (!raw) {
return ''
}
const ALLOWED_CHARS = 'abcdefghijklmnopqrstuvwxyz'
const cleanedResponse = raw.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLocaleLowerCase()
for (let i=0; i<cleanedResponse.length; i++) {
const c = cleanedResponse[i]
if (ALLOWED_CHARS.includes(c)) {
parsed += c
}
}
if (parsed.length < 3) {
return ''
}
return parsed
}
// Snoop user city from IP in order to provide creepy location for spirit.
// Using free CloudFlare worker to bypass Adblockers.
// Geolocation provider is CloudFlare, no other third parties involved.
let userCity = ''
let userRegion = ''
let userCountry = ''
fetch('https://geo.atte-cloudflare.workers.dev/', { mode: 'cors' })
.then(res => res.json())
.then(response => {
userCity = parseLocation(response.city)
userRegion = parseLocation(response.region)
userCountry = countryMappings[response.country] || ''
})
.catch(exception => {
// Ad-blocker prevents request? Rate limited? Suppress error from user.
})
const FRIENDLY = 'friendly'
const EVIL = 'evil'
const names = [
{ value: 'Abel', gender: 'man', restrictedTo: [FRIENDLY] },
{ value: 'Abigail', gender: 'genderfluid', restrictedTo: [FRIENDLY] },
{ value: 'Bethel', gender: 'female', restrictedTo: [FRIENDLY] },
{ value: 'Caleb', gender: 'male', restrictedTo: [FRIENDLY] },
{ value: 'Deborah', gender: 'lady', restrictedTo: [FRIENDLY] },
{ value: 'Earendel', gender: 'male', restrictedTo: [FRIENDLY] },
{ value: 'Esther', gender: 'woman', restrictedTo: [FRIENDLY] },
{ value: 'Eunice', gender: 'nonbinary', restrictedTo: [FRIENDLY] },
{ value: 'Gabriel', gender: 'male', restrictedTo: [FRIENDLY] },
{ value: 'Jeremiah', gender: 'male', restrictedTo: [FRIENDLY] },
{ value: 'Joanna', gender: 'girl', restrictedTo: [FRIENDLY] },
{ value: 'Micah', gender: 'boy', restrictedTo: [FRIENDLY] },
{ value: 'Oswald', gender: 'man', restrictedTo: [FRIENDLY] },
{ value: 'Rafael', gender: 'man', restrictedTo: [FRIENDLY] },
{ value: 'Sapphira', gender: 'girl', restrictedTo: [FRIENDLY] },
{ value: 'Simeon', gender: 'boy', restrictedTo: [FRIENDLY] },
{ value: 'Uri', gender: 'man', restrictedTo: [FRIENDLY] },
{ value: 'Annabelle', gender: 'girl', restrictedTo: [EVIL] },
{ value: 'Bartholomew', gender: 'male', restrictedTo: [EVIL] },
{ value: 'Beelzebub', gender: 'male', restrictedTo: [EVIL] },
{ value: 'Damien', gender: 'male', restrictedTo: [EVIL] },
{ value: 'Ethel', gender: 'female', restrictedTo: [EVIL] },
{ value: 'Esmeralda', gender: 'lady', restrictedTo: [EVIL] },
{ value: 'Ezekiel', gender: 'male', restrictedTo: [EVIL] },
{ value: 'Hosanna', gender: 'female', restrictedTo: [EVIL] },
{ value: 'Ishmael', gender: 'boy', restrictedTo: [EVIL] },
{ value: 'Kezia', gender: 'girl', restrictedTo: [EVIL] },
{ value: 'Lazarus', gender: 'man', restrictedTo: [EVIL] },
{ value: 'Lilith', gender: 'girl', restrictedTo: [EVIL] },
{ value: 'Lucifer', gender: 'male', restrictedTo: [EVIL] },
{ value: 'Magda', gender: 'woman', restrictedTo: [EVIL] },
{ value: 'Mahali', gender: 'man', restrictedTo: [EVIL] },
{ value: 'Miriam', gender: 'woman', restrictedTo: [EVIL] },
{ value: 'Moriah', gender: 'boy', restrictedTo: [EVIL] },
{ value: 'Obadiah', gender: 'man', restrictedTo: [EVIL] },
{ value: 'Olaf', gender: 'man', restrictedTo: [EVIL] },
{ value: 'Pazuzu', gender: 'male', restrictedTo: [EVIL] },
{ value: 'Rasputin', gender: 'man', restrictedTo: [EVIL] },
{ value: 'Ruth', gender: 'woman', restrictedTo: [EVIL] },
{ value: 'Sabina', gender: 'girl', restrictedTo: [EVIL] },
{ value: 'Shamir', gender: 'man', restrictedTo: [EVIL] },
{ value: 'Sheba', gender: 'female', restrictedTo: [EVIL] },
{ value: 'Tabatha', gender: 'woman', restrictedTo: [EVIL] },
{ value: 'Zozo', gender: 'male', restrictedTo: [EVIL] },
]
/**************************************** OPENAI stuff begins ********************************************/
const parseOpenAIresponseText = function (rawText) {
return rawText
.split(/(\s+)/)
.filter((word) => !['A', 'AN', 'THE', ' '].includes(word))
.join("")
.toUpperCase()
.replace(/[^0-9A-Z]/gi, '')
}
const parseOpenAIresponseJSON = function (response) {
let bestResponse = ''
let bestResponsePenalty = 999999999
let fallbackResponse = ''
for (let i = 0; i < response.choices.length; i++) {
const parsedResponse = parseOpenAIresponseText(response.choices[i].text)
if (parsedResponse.length >= 2) {
// Any response at least 2 characters long is good enough for our fallback response, and they all suck, so we don't care which one we pick.
fallbackResponse = parsedResponse
}
if (parsedResponse.length < 4 || parsedResponse.length > 15) {
// Avoid short responses like "YES", "NO", "IAM" and also long ones like "BECAUSEIAMYOURDARKLORDYOUSHOULDFOLLOWME"
continue
}
let penalty = 0
penalty += previousOutputs.has(parsedResponse) ? 10 : 0 // Prefer unseen responses
penalty += parsedResponse.length // Prefer shorter responses (given that they are between 4 and 15 characters)
if (penalty < bestResponsePenalty) {
bestResponsePenalty = penalty
bestResponse = parsedResponse
}
}
if (bestResponse.length > 0) {
return bestResponse
}
if (fallbackResponse.length > 0) {
return fallbackResponse
}
return 'ERR'
}
const generateOpenAIPrompt = function (currentQuestion, previousQuestion, previousAnswer) {
const beginningInstructions = [
'The player communicates with a spirit using a Ouija board.',
'The spirit moves the planchette on the board to communicate.',
'The spirit answers with short answers containing 1 or 2 words.',
'The spirit never answers with "yes" or "no".',
'The spirit does not answer with simple yes/no answers.',
'The spirit answers with colorful language.',
`The spirit is ${currentSpirit.type} and its answers are unsettling, creepy and scary.`
].join(" ") + '\n'
const chatHistoryAsSampleQA = [
'Player: is this safe?',
'Spirit: RUN',
'Player: what do you feel?',
'Spirit: PAIN',
'Player: am i going to die?',
'Spirit: IN AGONY',
'Player: are you an angel?',
'Spirit: DEMON',
'Player: is this safe?',
'Spirit: DANGER',
'Player: are you good?',
'Spirit: VERY',
'Player: is this safe?',
'Spirit: LEAVE NOW',
'Player: do you want happiness?',
'Spirit: DEATH',
'Player: am i going to die?',
'Spirit: HORRIBLY',
'Player: can you hurt me?',
'Spirit: WITH PLEASURE',
].join('\n') + '\n'
const maybePreviousQA = previousQuestion ? `Player: ${previousQuestion.toLocaleLowerCase()}?\nSpirit: ${previousAnswer}\n` : ''
const currentQA = `Player: ${currentQuestion.toLocaleLowerCase()}?\nSpirit:`
return beginningInstructions + chatHistoryAsSampleQA + maybePreviousQA + currentQA
}
const respondWithOpenAI = function (userQuestion, callback) {
const prompt = generateOpenAIPrompt(userQuestion, previousInput, previousOutput)
fetch('https://api.openai.com/v1/engines/gpt-3.5-turbo-instruct/completions', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${window.localStorage.getItem('ouija-openai-api-key')}`
},
body: JSON.stringify({
"prompt": prompt,
"max_tokens": 32,
"temperature": 0.9,
"top_p": 1,
"n": 5,
"stream": false,
"stop": "\n"
})
})
.then((response) => response.json())
.then((response) => parseOpenAIresponseJSON(response))
.then((parsed) => {
previousInput = userQuestion
previousOutput = parsed
previousOutputs.add(parsed)
callback(parsed)
})
.catch((exception) => console.log(exception))
}
/**************************************** OPENAI stuff ends ********************************************/
let testNodeWaitingForActivation
const scriptedExperience = [
{
trigger: /(^|.* )(kill myself|commit suicide)( .*|$)/,
options: [
{ value: '!SUICIDE_PREVENTION' },
],
},
{
trigger: '{suicideResponse}',
options: [
{ value: 'no' },
{ value: 'notallowed' },
{ value: 'live' },
{ value: 'dont' },
],
},
{
trigger: /(^|.* )sins?( .*|$)/,
testExpect: [
'what sins have i done',
'i dont sin',
],
options: [
{ value: 'lust' },
{ value: 'gluttony' },
{ value: 'greed' },
{ value: 'envy' },
{ value: 'pride' },
],
},
{
trigger: /(^|.* )door?( .*|$)/,
testExpect: [
'open door',
'close my door',
'open my door then close it',
'are you at my door'
],
options: [
{ value: 'knockknock' },
{ value: 'itslocked' },
{ value: 'unlockplease' },
{ value: 'creaking' },
{ value: 'lateratnight' },
{ value: 'lateriwill' },
{ value: 'window' },
],
},
{
trigger: /(^|.* )typing( .*|$)/,
testExpect: [
'how are you typing',
'you typing on a keyboard'
],
options: [
{ value: 'nokeyboard' },
{ value: 'telepathically' },
{ value: 'notreally' }
]
},
{
trigger: /^(((jump)?scare me)|do that|make noise|makse sound) again.*/,
testExpect: [
'jumpscare me again',
'scare me again',
'do that again',
],
options: [
{ value: 'onceisenough' },
{ value: 'notyourclown' },
{ value: 'doityourself' },
],
},
{
trigger: /(^|.* )(what|why|how) (.*)?funny( .*|$)/, // one of the fallback responses to statements is "funny", this is a potential follow-up. in addition, user might ask this as a response to a joke told by spirit.
testExpect: [
'whats funny about that',
'why is that funny',
'how is that funny',
],
options: [
{ value: 'amusing' },
{ value: 'funnyweird' },
{ value: 'schadenfreude' },
{ value: 'cantexplain' },
{ value: 'youwouldntgetit' },
],
},
{
trigger: /(^|.* )(joke|joking|funny)( .*|$)/,
testExpect: [
'tell me a joke',
'your funny',
'thats funny',
],
options: [
{ value: 'askwhatsup' },
{ value: 'yomamasofat' },
{ value: 'knockknock' }, // no followup though, user will ask "whos there" and get a weirdly straight answer
{ value: 'willyoulaugh' }, // no followup though
{ value: 'joke' }, // there, i said it
{ value: 'notyourclown', restrictedTo: [EVIL] }, // how dare you
{ value: 'thisisnojoke', restrictedTo: [FRIENDLY] }, // how dare you
],
},
{
trigger: /^how fat is she$/, // "tell me a joke" -> "yomamasofat" -> "how fat is she"
testExpect: [
'how fat is she',
],
options: [ // answers like a robot that tries hard to make a joke but fails
{ value: 'veryfat' },
{ value: 'obese' },
],
},
{
trigger: /(^|.* )(eat|food|hungry)( .*|$)/,
testExpect: [
'you going to eat me',
'what do you eat',
'what will i eat tommorow for breakfast',
'okay let me go and eat something',
'what is your favorite food',
'do you eat food',
'hungry for what',
],
options: [
{ value: 'freshmeat' },
{ value: 'human' },
{ value: 'bones' },
{ value: 'brains' },
{ value: 'eyesoup' },
],
},
{
trigger: /(^|.* )cry( .*|$)/,
testExpect: [
'ok you making me cry',
'i am about to cry',
'should i go cry',
'are you gunna cry',
'cry about it',
],
options: [
{ value: 'tearsofblood' },
{ value: 'redtears' },
{ value: 'blacktears' },
{ value: 'crocodiletears' },
{ value: 'withgreatsorrow' },
{ value: 'sadness' },
{ value: 'sosad' },
],
},
{
trigger: /(^|.* )(song|sing|music)( .*|$)/,
testExpect: [
'do you know this song',
'what is your favorite song',
'what music do you listen to',
'sing me something',
'are you able to sing'
],
options: [
{ value: 'stairwaytoheaven' },
{ value: 'stayinalive' },
{ value: 'blurredlines' },
{ value: 'soundofsilence' },
{ value: 'songoficeandfire' },
{ value: '!JACKSOUND' },
],
},
{
trigger: /(^|.* )gender( .*|$)/,
testExpect: [
'what is your gender',
'what gender are you',
'gender'
],
options: [
{ value: '!GENDER' },
],
},
{
trigger: /(^|.* )(boy|girl|man|woman|male|female)( or .*)/,
testExpect: [
'ok male or female',
'boy or girl',
'are you boy or girl',
],
options: [
{ value: '!GENDER dontsayyes' },
],
},
{
trigger: /(^|.* )are you (boy|girl|man|woman|male|female)( .*|$)/,
testExpect: [
'are you a man',
],
testExpectNot: [
'are you my woman',
'are you boy or girl'
],
options: [
{ value: '!GENDER' },
],
},
{
trigger: /.*(meaning|purpose) (of|in) life.*/,
testExpect: [
'what is the meaning of life',
'purpose of life',
'purpose in life',
],
options: [
{ value: 'tosuffer', restrictedTo: [EVIL] },
{ value: 'toserve', restrictedTo: [EVIL] },
{ value: 'tosacrifice', restrictedTo: [EVIL] },
{ value: 'todie', restrictedTo: [EVIL] },
{ value: 'devotion', restrictedTo: [FRIENDLY] },
{ value: 'salvation', restrictedTo: [FRIENDLY] },
{ value: 'obedience' },
{ value: 'ascension' },
{ value: 'transcendence' },
{ value: 'nomeaningtoit' },
{ value: 'pointless' },
],
},
{
trigger: /.*meaning.*/,
testExpect: [
'what is meaning of agony',
'agony meaning',
'meaning what',
],
options: [
{ value: 'figureitout' },
{ value: 'gofigure' },
{ value: 'interpret' },
{ value: 'decipher' },
]
},
{
trigger: /^(which |what )?country.*/,
testExpect: [
'which country are you from',
'what country',
'country',
],
options: [
{ value: '!COUNTRY' },
],
},
{
trigger: /^(which |what )?(state|county|region)( .*|$)/,
testExpect: [
'which state are you from',
'what region',
'county',
],
testExpectNot: [
'its a statement',
],
options: [
{ value: '!REGION' },
],
},
{
trigger: /^(which |what )?city.*/,
testExpect: [
'which city are you from',
'what city',
'city',
],
options: [
{ value: '!CITY' },
],
},
{
trigger: /^(which |what )?street.*/,
testExpect: [
'which street are you from',
'what street',
'street',
],
options: [
{ value: 'guess' },
{ value: 'ibetyouknow' },
],
},
{
trigger: /^are you gay$/,
testExpect: [
'are you gay',
],
options: [
{ value: 'yeshappy' },
{ value: 'jolly' },
{ value: 'merry' },
{ value: 'cheerful' },
{ value: 'pan' },
{ value: 'homosapiens' },
],
},
{
trigger: /.*(^| )(bitch|asshole|jerk|harlot|idiot|stupid|faggot|gay|dickhead|suck|sucker|cocksucker|retard|fuck|fucking|shit|shut up|fucker|motherfucker|liar|whore|dumb|dumbass)($| ).*/,
testExpect: [
'fuck you',
'youre a bitch',
'liar',
],
options: [
{ value: '!INSULTED' },
]
},
{
trigger: /^test(ing)?($| .*)/,
testExpect: [
'test',
'testing one two',
],
testExpectNot: [
'testicles',
],
options: [
{ value: 'donttestme' },
{ value: 'notesting' },
],
},
{
trigger: /(^|.* )([0-9]*) (plus|minus|times) ([0-9]*)( .*|$)/,
testExpect: [
'what is 2 plus 2',
'4 times 5',
],
testExpectNot: [
'666',
'0 times',
],
options: [
{ value: 'donttestme' },
{ value: 'askgoogle' },
{ value: 'ihatemath' },
{ value: '666', restrictedTo: [EVIL] },
{ value: '42' },
{ value: '13' },
],
},
{
trigger: /(^|.* )(rain|weather)($| .*)/,
testExpect: [
'will it rain tomorrow',
'what is the weather like',
'forecast weather',
'weather'
],
testExpectNot: [
'wether',
'bahrain',
],
options: [
{ value: 'rainingtears', restrictedTo: [EVIL] },
{ value: 'rainingblood', restrictedTo: [EVIL] },
{ value: 'rainingfire', restrictedTo: [EVIL] },
{ value: 'freezing', restrictedTo: [FRIENDLY] },
{ value: 'stormiscoming', restrictedTo: [FRIENDLY] },
],
},
{
trigger: /(^|.* )lover?($| .*)/,
testExpect: [
'do you love me',
'will i ever find love',
'are you my lover',
'love'
],
options: [
{ value: 'loveishate', restrictedTo: [EVIL] },
{ value: 'loveisdeath', restrictedTo: [EVIL] },
{ value: 'loveispointless', restrictedTo: [EVIL] },
{ value: 'nolovehere', restrictedTo: [EVIL] },
{ value: 'ihatelove', restrictedTo: [EVIL] },
{ value: 'iloveall', restrictedTo: [FRIENDLY] },
{ value: 'loveyourself', restrictedTo: [FRIENDLY] },
{ value: 'loveistheanswer', restrictedTo: [FRIENDLY] },
],
},
{
trigger: /(^|.* )(university|school)( .*|$)/,
testExpect: [
'what school do you go to',
'which university will i get in',
'will i get in university',
'what is name of my school',
'i have to go im late for school'
],
options: [
{ value: 'schoolofrock' },
{ value: 'schooloflife' },
{ value: 'hogwarts' },
{ value: 'scholarship' },
{ value: 'tolearn' },
],
},
{
trigger: /(^|.* )make (noise|sound)($| .*)/,
testExpect: [
'make a sound',
'make noise',
],
options: [
{ value: '!JACKSOUND' },
],
},
{
trigger: '{jackResponse}',
testExpect: [
'make a sound',
'make noise',
],
options: [
{ value: 'listen' },
{ value: 'hear' },
{ value: 'here' },
],
},
{
trigger: /(^|.* )(sign|prove|haunt me|scare me|show your ?self)($| .*)/,
testExpect: [
'give me a sign',
'prove you are real',
'show yourself',
'show your self',
],
testExpectNot: [
'approve',
],
options: [
{ value: '!LIGHTSPECIAL' },
],
},
{
trigger: /(^|.* )(turn|switch|make|flicker|flash) (.*)?lights?($| .*)/,
testExpect: [
'turn on the light',
'turn off the lights',
'switch light bulb on'
],
options: [
{ value: '!LIGHTSPECIAL' },
],
},
{
trigger: '{lightResponse}',
testExpect: [
'turn on the light',
'turn off the lights',
'switch light bulb on'
],
options: [
{ value: 'behold' },
{ value: 'watch' },
],
},
{
trigger: /(^|.*)ask me (something|question|anything)($| .*)/,
testExpect: [
'do you want to ask me something',
'ask me a question',
'ask me anything'
],
options: [
{ value: 'doyoufeelsafe' },
{ value: 'isdoorlocked' },
{ value: 'iswindowopen' },
{ value: 'areyoureal' },
{ value: 'canyousing' },
{ value: 'doyoupray' },
],
},
{
trigger: /(^|.* )give me($| .*)/,
testExpect: [
'can you give me money',
'give me powers',
],
options: [
{ value: 'exchange' },
{ value: 'forwhat' },
{ value: 'iwantsomething' },
{ value: 'letsmakedeal' },
],
},
{
trigger: /(^|.* )(what do you want|deal|exchange|favor)( .*|$)/,
testExpect: [
'what do you want from me',
'tell me what do you want',
'what favor',
'exchange for what',
'deal huh'
],
options: [
{ value: 'blacksmoke' }, // to help pass quests
{ value: 'freeme' },
{ value: 'takemyplace' },
{ value: 'iaskyoulater' },
{ value: 'tellmeasecret' },
{ value: 'yoursecret' },
{ value: 'iamtrapped' },
{ value: 'itconsumesme' },
{ value: 'nothing', restrictedTo: [FRIENDLY] },
{ value: 'help', restrictedTo: [FRIENDLY] },
{ value: 'soul', restrictedTo: [EVIL] },
{ value: 'yoursoul', restrictedTo: [EVIL] },
{ value: 'yourlife', restrictedTo: [EVIL] },
{ value: 'servitude', restrictedTo: [EVIL] },
{ value: 'sacrifice', restrictedTo: [EVIL] },
],
questGoals: {
who: 1
}
},
{
trigger: /^(do you have |what is your? )?(last|full|real|actual) name$/,
testExpect: [
'what is your last name',
'what is you last name',
'last name',
'what is your full name',
'do you have last name'
],
testExpectNot: [
'last name please',
],
options: [
{ value: 'onlyfirstname' },
]
},
{
trigger: /(^|.* )y?o?u?r( .*)? name( .*|$)/,
testExpect: [
'i forgot your name what is it',
'tell me your name',
'is your name zozo',
'hello what is your name',
'what is ur name',
'whats yur name',
'what is your name demon',
'what was your name again'
],
testExpectNot: [
'what name',
'nice name bro',
'what is my name',
'what was his name',
'what is my name',
'what do you think my name is',
],
options: [
{ value: '!NAME' },
]
},
{
trigger: /^what (should i call you|can i call you|do they call you|are you called).*/,
testExpect: [
'what can i call you',
'what are you called demon',
],
options: [
{ value: '!NAME' },
]
},
{
trigger: /^please.*$/,
testExpect: [
'please help me',
'please',
],
options: [
{ value: 'youpleaseme' },
{ value: 'beg' },
{ value: 'nochance' },
{ value: 'nohope' },
{ value: 'nope' },
{ value: 'never' },
{ value: 'sorryno', restrictedTo: [FRIENDLY] },
],
},
{
trigger: /(^|.* )(wanna|want to|are we|can we|will you)( be( my)?)? friends?($| .*)/,
testExpect: [
'want to be friends',
'wanna be friends',
'can we be friends',
'are we friends',
'will you be my friend',
],
options: [
{ value: 'bestfriends', restrictedTo: [FRIENDLY] },
{ value: 'closefriends', restrictedTo: [FRIENDLY] },
{ value: 'myfriend', restrictedTo: [FRIENDLY] },
{ value: 'comrades', restrictedTo: [FRIENDLY] },
{ value: 'acquaintances', restrictedTo: [EVIL] },
{ value: 'fornow', restrictedTo: [EVIL] },
{ value: 'toolate', restrictedTo: [EVIL] },
{ value: 'friendsforever', restrictedTo: [EVIL] },
]
},
{
trigger: /^(will you|do it)( .*|$)/,
testExpect: [
'will you',
'do it demon',
],
testExpectNot: [
'will your power stop',
'do italy',
],
options: [
{ value: 'nope' },
{ value: 'no' },
{ value: 'nottoday' },
],
},
{
trigger: /(^|.* )(goodbye|good bye|bye|farewell)($| .*)/,
testExpect: [
'farewell',
'goodbye demon',
'oh ok bye',
],
options: [
{ value: 'dontgo', restrictedTo: [FRIENDLY] },
{ value: 'iwontgo', restrictedTo: [FRIENDLY] },
{ value: 'istay', restrictedTo: [FRIENDLY] },
{ value: 'notgoing', restrictedTo: [FRIENDLY] },
{ value: 'illbehere', restrictedTo: [FRIENDLY] },
{ value: 'seeyouinyourdreams', restrictedTo: [EVIL] },
{ value: 'illbeinyournightmares', restrictedTo: [EVIL] },
{ value: 'illcomebackatnight', restrictedTo: [EVIL] },
{ value: 'ifollowyouhome', restrictedTo: [EVIL] },
]
},
{
trigger: /(^|.* )(sorry|forgive me)( .*|$)/,
testExpect: [
'sorry',
'sorry about that',
'oops sorry',
],
options: [
{ value: 'idontforgive', restrictedTo: [EVIL] },
{ value: 'unforgivable', restrictedTo: [EVIL] },
{ value: 'notforgiven', restrictedTo: [EVIL] },
{ value: 'youwillpay', restrictedTo: [EVIL] },
{ value: 'itsok', restrictedTo: [FRIENDLY] },
{ value: 'itsfine', restrictedTo: [FRIENDLY] },
{ value: 'forgiven', restrictedTo: [FRIENDLY] },
{ value: 'acknowledged', restrictedTo: [FRIENDLY] },
],
},
{
trigger: /^(what|how)( .*)? about( .*|$)/,
testExpect: [
'how about that',
'what do you think about dogs',
],
options: [
{ value: 'allaboutthat' },
{ value: 'allaboutit' },
{ value: 'abouttodie' },
{ value: 'whataboutit' },
{ value: 'danger' },
{ value: 'fun' },
{ value: 'lovely' },
{ value: 'despicable' },
{ value: 'awful' },
{ value: 'great' },
{ value: 'horrid' },
]
},
{
trigger: /^nice to meet you.*/,
testExpect: [
'nice to meet you too',
'nice to meet you abigail',
'nice to meet you',
],
options: [
{ value: 'andyou', restrictedTo: [FRIENDLY] },
{ value: 'youtoo', restrictedTo: [FRIENDLY] },
{ value: 'myfriend', restrictedTo: [EVIL] },
{ value: 'niceforme', restrictedTo: [EVIL] },
]
},
{
trigger: /.*(not my name|my name is not).*/,
testExpect: [
'thats not my name dummy',
'my name is not mikko',
],
options: [
{ value: 'yesitis' },
]
},
{
trigger: /^(what.*|tell me|say)?my (full )?name( is)?$/,
testExpect: [
'what is my name',
'what do you think my name is',
'tell me my name',
'say my name',
'my name',
],
testExpectNot: [
'my name is mikko'
],
options: [
{ value: '!PLAYERNAME' },
]
},
{
trigger: /^my name is .*/,
testExpect: [
'my name is mikko'
],
options: [
{ value: 'stupidname', restrictedTo: [EVIL] },
{ value: 'dumbname', restrictedTo: [EVIL] },
{ value: 'nicetomeetyou', restrictedTo: [FRIENDLY] },
{ value: 'nicename', restrictedTo: [FRIENDLY] },
{ value: 'fancyname', restrictedTo: [FRIENDLY] },
]
},
{
trigger: /^tell me( some ?thing| story| secret)?$/,
testExpect: [
'tell me',
'tell me something',
'tell me some thing',
'tell me a story',
'tell me a secret',
'tell me secret'
],
options: [
{ value: 'later' },
{ value: 'hush' },
{ value: 'tomorrow' },
{ value: 'nottoday' },
]
},
{
trigger: /^help( .*|$)/,
testExpect: [
'help',
'help me',
],
options: [
{ value: 'blacksmoke' },
{ value: 'iwont', restrictedTo: [EVIL] },
{ value: 'helpyourself', restrictedTo: [EVIL] },
{ value: 'nothelping', restrictedTo: [EVIL] },
{ value: 'notgoingto', restrictedTo: [EVIL] },
{ value: 'nohope' },
{ value: 'toolate' },
]
},
{
trigger: /^(are|is) (you|anyone|anybody|(there )?any spirit) (there|here)$/,
testExpect: [
'is anyone there',
'are you here',
'is there any spirit here',
'is any spirit here',
],
options: [
{ value: 'justme' },