-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathjs.js
executable file
·587 lines (560 loc) · 24.8 KB
/
js.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
// Javascript code for the bot ui of team-pan
var botui = new BotUI('pan-bot-ui');
botui.message.add({
delay: 1000,
loading: true,
content: 'Hello, My name is Pan. I will be your user friendly bot for today!'
}).then(function() {
botui.message.add({ // show a message
delay: 1000,
loading: true,
content: 'Whats your name?'
}).then(function() { // wait till its shown
return botui.action.text({ // show 'text' action
action: {
placeholder: 'Your name'
}
});
}).then(function(res) { // get the result
botui.message.add({
content: 'Hello ' + res.value + ', ' +
'How can I help you today?'
});
})
.then(function() { // The questions the bot can answer, set 1
return botui.action.button({
delay: 1000,
loading: true,
action: [{
text: 'What is HNG?',
value: 'hng'
}, {
text: 'I am a newbie and have no experience, is the programme for me?',
value: 'newbie'
}, {
text: 'How do I join HNG?',
value: 'join'
}, {
text: 'Is the Internship free?',
value: 'free'
}, {
text: 'Will the internship pay the interns or support me?',
value: 'support'
}, {
text: 'What do I need to get started?',
value: 'need'
}, {
text: 'What programmes will I learn or do in the internship?',
value: 'programmes'
}, {
text: 'Will I get a job from the internship?',
value: 'job'
}]
});
})
.then(function(res) { //the answer to bot questions
var message;
if (res.value === "hng") {
message =
'HNG internship is a 3 months remote internship designed to find and develop the most ' +
'talented software developers.';
} else if (res.value == "newbie") {
message =
'Yes, this programme is for you. There is a pre-internship to prepare the newbies.<br>' +
' If you are dedicated, you will be able to do well.' +
' To know more visit <a href="https://hng.tech/about">HNG</a>';
} else if (res.value === "join") {
message =
'Follow the link and join. its an easy process. ' +
'<a href="https://hng.tech/become-intern">Join</a>';
} else if (res.value === "free") {
message =
'Yes, The HNG internship is completely free.';
} else if (res.value === "support") {
message =
'In the past, we have paid interns a monthly stipends, but because of the large number of ' +
'interns we take in yearly, we do not pay the interns except in some circumstance.';
} else if (res.value === "need") {
message =
'You will need the following to do this internship successfully:' +
'<br> A Laptop <br>' +
'Internet<br>Time<br>Electricity.';
} else if (res.value === "programmes") {
message =
'You will have the opportunity to learn ' +
'<br> Design <br> Frontend Development <br>' +
'Backend Development <br> Machine Learning' +
'<br>Digital Marketing <br>Android Development' +
'<br> Sale Engineering';
} else if (res.value === "job") {
message =
'Yes, if you complete the internship successfully, there will be job oppurtunities. ' +
'We will also prepare you for interviews and help you with how to build a work profile. ' +
'Take a look at our past interns <br>' +
'<a href="https://hng.tech/interns">HNG INTERNS</a>';
}
return botui.message.add({
type: 'html',
delay: 1000,
loading: true,
content: message
});
})
.then(function() { // The questions the bot can answer, set 2
return botui.action.button({
delay: 1000,
loading: true,
action: [{
text: 'What is HNG?',
value: 'hng'
}, {
text: 'I am a newbie and have no experience, is the programme for me?',
value: 'newbie'
}, {
text: 'How do I join HNG?',
value: 'join'
}, {
text: 'Is the Internship free?',
value: 'free'
}, {
text: 'Will the internship pay the interns or support me?',
value: 'support'
}, {
text: 'What do I need to get started?',
value: 'need'
}, {
text: 'What programmes will I learn or do in the internship?',
value: 'programmes'
}, {
text: 'Will I get a job from the internship?',
value: 'job'
}]
});
}).then(function(res) {
var message;
if (res.value === "hng") {
message =
'HNG internship is a 3 months remote internship designed to find and develop the most ' +
'talented software developers.';
} else if (res.value == "newbie") {
message =
'Yes, this programme is for you. There is a pre-internship to prepare the newbies.<br>' +
' If you are dedicated, you will be able to do well.' +
' To know more visit <a href="https://hng.tech/about">HNG</a>';
} else if (res.value === "join") {
message =
'Follow the link and join. its an easy process. ' +
'<a href="https://hng.tech/become-intern">Join</a>';
} else if (res.value === "free") {
message =
'Yes, The HNG internship is completely free.';
} else if (res.value === "support") {
message =
'In the past, we have paid interns a monthly stipends, but because of the large number of ' +
'interns we take in yearly, we do not pay the interns except in some circumstance.';
} else if (res.value === "need") {
message =
'You will need the following to do this internship successfully:' +
'<br> A Laptop <br>' +
'Internet<br>Time<br>Electricity.';
} else if (res.value === "programmes") {
message =
'You will have the opportunity to learn ' +
'<br> Design <br> Frontend Development <br>' +
'Backend Development <br> Machine Learning' +
'<br>Digital Marketing <br>Android Development' +
'<br> Sale Engineering';
} else if (res.value === "job") {
message =
'Yes, if you complete the internship successfully, there will be job oppurtunities. ' +
'We will also prepare you for interviews and help you with how to build a work profile. ' +
'Take a look at our past interns <br>' +
'<a href="https://hng.tech/interns">HNG INTERNS</a>';
}
return botui.message.add({
type: 'html',
delay: 1000,
loading: true,
content: message
});
})
.then(function() { // The questions the bot can answer, set 3
return botui.action.button({
delay: 1000,
loading: true,
action: [{
text: 'What is HNG?',
value: 'hng'
}, {
text: 'I am a newbie and have no experience, is the programme for me?',
value: 'newbie'
}, {
text: 'How do I join HNG?',
value: 'join'
}, {
text: 'Is the Internship free?',
value: 'free'
}, {
text: 'Will the internship pay the interns or support me?',
value: 'support'
}, {
text: 'What do I need to get started?',
value: 'need'
}, {
text: 'What programmes will I learn or do in the internship?',
value: 'programmes'
}, {
text: 'Will I get a job from the internship?',
value: 'job'
}]
});
}).then(function(res) {
var message;
if (res.value === "hng") {
message =
'HNG internship is a 3 months remote internship designed to find and develop the most ' +
'talented software developers.';
} else if (res.value == "newbie") {
message =
'Yes, this programme is for you. There is a pre-internship to prepare the newbies.<br>' +
' If you are dedicated, you will be able to do well.' +
' To know more visit <a href="https://hng.tech/about">HNG</a>';
} else if (res.value === "join") {
message =
'Follow the link and join. its an easy process. ' +
'<a href="https://hng.tech/become-intern">Join</a>';
} else if (res.value === "free") {
message =
'Yes, The HNG internship is completely free.';
} else if (res.value === "support") {
message =
'In the past, we have paid interns a monthly stipends, but because of the large number of ' +
'interns we take in yearly, we do not pay the interns except in some circumstance.';
} else if (res.value === "need") {
message =
'You will need the following to do this internship successfully:' +
'<br> A Laptop <br>' +
'Internet<br>Time<br>Electricity.';
} else if (res.value === "programmes") {
message =
'You will have the opportunity to learn ' +
'<br> Design <br> Frontend Development <br>' +
'Backend Development <br> Machine Learning' +
'<br>Digital Marketing <br>Android Development' +
'<br> Sale Engineering';
} else if (res.value === "job") {
message =
'Yes, if you complete the internship successfully, there will be job oppurtunities. ' +
'We will also prepare you for interviews and help you with how to build a work profile. ' +
'Take a look at our past interns <br>' +
'<a href="https://hng.tech/interns">HNG INTERNS</a>';
}
return botui.message.add({
type: 'html',
delay: 1000,
loading: true,
content: message
});
})
.then(function() { // The questions the bot can answer, set 4
return botui.action.button({
delay: 1000,
loading: true,
action: [{
text: 'What is HNG?',
value: 'hng'
}, {
text: 'I am a newbie and have no experience, is the programme for me?',
value: 'newbie'
}, {
text: 'How do I join HNG?',
value: 'join'
}, {
text: 'Is the Internship free?',
value: 'free'
}, {
text: 'Will the internship pay the interns or support me?',
value: 'support'
}, {
text: 'What do I need to get started?',
value: 'need'
}, {
text: 'What programmes will I learn or do in the internship?',
value: 'programmes'
}, {
text: 'Will I get a job from the internship?',
value: 'job'
}]
});
}).then(function(res) {
var message;
if (res.value === "hng") {
message =
'HNG internship is a 3 months remote internship designed to find and develop the most ' +
'talented software developers.';
} else if (res.value == "newbie") {
message =
'Yes, this programme is for you. There is a pre-internship to prepare the newbies.<br>' +
' If you are dedicated, you will be able to do well.' +
' To know more visit <a href="https://hng.tech/about">HNG</a>';
} else if (res.value === "join") {
message =
'Follow the link and join. its an easy process. ' +
'<a href="https://hng.tech/become-intern">Join</a>';
} else if (res.value === "free") {
message =
'Yes, The HNG internship is completely free.';
} else if (res.value === "support") {
message =
'In the past, we have paid interns a monthly stipends, but because of the large number of ' +
'interns we take in yearly, we do not pay the interns except in some circumstance.';
} else if (res.value === "need") {
message =
'You will need the following to do this internship successfully:' +
'<br> A Laptop <br>' +
'Internet<br>Time<br>Electricity.';
} else if (res.value === "programmes") {
message =
'You will have the opportunity to learn ' +
'<br> Design <br> Frontend Development <br>' +
'Backend Development <br> Machine Learning' +
'<br>Digital Marketing <br>Android Development' +
'<br> Sale Engineering';
} else if (res.value === "job") {
message =
'Yes, if you complete the internship successfully, there will be job oppurtunities. ' +
'We will also prepare you for interviews and help you with how to build a work profile. ' +
'Take a look at our past interns <br>' +
'<a href="https://hng.tech/interns">HNG INTERNS</a>';
}
return botui.message.add({
type: 'html',
delay: 1000,
loading: true,
content: message
});
})
.then(function() { // The questions the bot can answer, set 5
return botui.action.button({
delay: 1000,
loading: true,
action: [{
text: 'What is HNG?',
value: 'hng'
}, {
text: 'I am a newbie and have no experience, is the programme for me?',
value: 'newbie'
}, {
text: 'How do I join HNG?',
value: 'join'
}, {
text: 'Is the Internship free?',
value: 'free'
}, {
text: 'Will the internship pay the interns or support me?',
value: 'support'
}, {
text: 'What do I need to get started?',
value: 'need'
}, {
text: 'What programmes will I learn or do in the internship?',
value: 'programmes'
}, {
text: 'Will I get a job from the internship?',
value: 'job'
}]
});
}).then(function(res) {
var message;
if (res.value === "hng") {
message =
'HNG internship is a 3 months remote internship designed to find and develop the most ' +
'talented software developers.';
} else if (res.value == "newbie") {
message =
'Yes, this programme is for you. There is a pre-internship to prepare the newbies.<br>' +
' If you are dedicated, you will be able to do well.' +
' To know more visit <a href="https://hng.tech/about">HNG</a>';
} else if (res.value === "join") {
message =
'Follow the link and join. its an easy process. ' +
'<a href="https://hng.tech/become-intern">Join</a>';
} else if (res.value === "free") {
message =
'Yes, The HNG internship is completely free.';
} else if (res.value === "support") {
message =
'In the past, we have paid interns a monthly stipends, but because of the large number of ' +
'interns we take in yearly, we do not pay the interns except in some circumstance.';
} else if (res.value === "need") {
message =
'You will need the following to do this internship successfully:' +
'<br> A Laptop <br>' +
'Internet<br>Time<br>Electricity.';
} else if (res.value === "programmes") {
message =
'You will have the opportunity to learn ' +
'<br> Design <br> Frontend Development <br>' +
'Backend Development <br> Machine Learning' +
'<br>Digital Marketing <br>Android Development' +
'<br> Sale Engineering';
} else if (res.value === "job") {
message =
'Yes, if you complete the internship successfully, there will be job oppurtunities. ' +
'We will also prepare you for interviews and help you with how to build a work profile. ' +
'Take a look at our past interns <br>' +
'<a href="https://hng.tech/interns">HNG INTERNS</a>';
}
return botui.message.add({
type: 'html',
delay: 1000,
loading: true,
content: message
});
})
.then(function() { // The questions the bot can answer, set 6
return botui.action.button({
delay: 1000,
loading: true,
action: [{
text: 'What is HNG?',
value: 'hng'
}, {
text: 'I am a newbie and have no experience, is the programme for me?',
value: 'newbie'
}, {
text: 'How do I join HNG?',
value: 'join'
}, {
text: 'Is the Internship free?',
value: 'free'
}, {
text: 'Will the internship pay the interns or support me?',
value: 'support'
}, {
text: 'What do I need to get started?',
value: 'need'
}, {
text: 'What programmes will I learn or do in the internship?',
value: 'programmes'
}, {
text: 'Will I get a job from the internship?',
value: 'job'
}]
});
}).then(function(res) {
var message;
if (res.value === "hng") {
message =
'HNG internship is a 3 months remote internship designed to find and develop the most ' +
'talented software developers.';
} else if (res.value == "newbie") {
message =
'Yes, this programme is for you. There is a pre-internship to prepare the newbies.<br>' +
' If you are dedicated, you will be able to do well.' +
' To know more visit <a href="https://hng.tech/about">HNG</a>';
} else if (res.value === "join") {
message =
'Follow the link and join. its an easy process. ' +
'<a href="https://hng.tech/become-intern">Join</a>';
} else if (res.value === "free") {
message =
'Yes, The HNG internship is completely free.';
} else if (res.value === "support") {
message =
'In the past, we have paid interns a monthly stipends, but because of the large number of ' +
'interns we take in yearly, we do not pay the interns except in some circumstance.';
} else if (res.value === "need") {
message =
'You will need the following to do this internship successfully:' +
'<br> A Laptop <br>' +
'Internet<br>Time<br>Electricity.';
} else if (res.value === "programmes") {
message =
'You will have the opportunity to learn ' +
'<br> Design <br> Frontend Development <br>' +
'Backend Development <br> Machine Learning' +
'<br>Digital Marketing <br>Android Development' +
'<br> Sale Engineering';
} else if (res.value === "job") {
message =
'Yes, if you complete the internship successfully, there will be job oppurtunities. ' +
'We will also prepare you for interviews and help you with how to build a work profile. ' +
'Take a look at our past interns <br>' +
'<a href="https://hng.tech/interns">HNG INTERNS</a>';
}
return botui.message.add({
type: 'html',
delay: 1000,
loading: true,
content: message
});
})
.then(function() {
botui.message.add({ // show a message
delay: 1000,
loading: true,
content: 'Do you have more questions?'
})
})
.then(function() { //confirm if user has more questions
return botui.action.button({
delay: 1000,
loading: true,
action: [{
text: "No! I don't have any more questions",
value: 'noquestion'
}, {
text: 'Yes! I have more questions',
value: 'question'
}]
});
})
.then(function(res) { // responses to question confirmation
var message;
if (res.value === "noquestion") {
message =
'I wish you all the best as you start the life changing journey with HNG!';
} else if (res.value === "question") {
message =
'For more questions, please visit the faq section of HNG Internship ' +
'<a href="https://slack-redir.net/link?url=https%3A%2F%2Fsites.google.com%2Fhotels.ng%2Finternship%2Ffaq-frequently-asked-questions">HERE</a>';
}
return botui.message.add({
type: 'html',
delay: 1000,
loading: true,
content: message
});
}).then(function(res) { //farewell button
return botui.action.button({
action: [{
delay: 3000,
loading: true,
text: 'This has been very enlightening, thank you!',
value: 'cool'
}]
});
}).then(function(index) {
return botui.message.add({
delay: 2000,
loading: true,
content: 'You are welcome'
});
}).then(function(index) {
return botui.action.button({
action: [{
delay: 1000,
loading: true,
text: 'Goodbye',
value: 'bye'
}]
});
}).then(function(index) { //closing message
return botui.message.add({
delay: 1000,
loading: true,
content: 'Bye, hope to see you again.'
});
});
});