Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

delivery.js 854 B

You have to be logged in to leave a comment. Sign In
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
  1. var builder = require('botbuilder');
  2. var Today = 'today';
  3. var Tomorrow = 'tomorrow';
  4. var lib = new builder.Library('delivery');
  5. lib.dialog('date', [
  6. function (session, args, next) {
  7. builder.Prompts.choice(session, 'choose_delivery_date', [
  8. session.gettext(Today),
  9. session.gettext(Tomorrow)
  10. ]);
  11. },
  12. function (session, args) {
  13. var deliveryDate = args.response.entity === session.gettext(Today) ? new Date() : new Date().addDays(1);
  14. session.endDialogWithResult({
  15. deliveryDate: deliveryDate
  16. });
  17. }
  18. ]);
  19. // Helpers
  20. Date.prototype.addDays = function (days) {
  21. var date = new Date(this.valueOf());
  22. date.setDate(date.getDate() + days);
  23. return date;
  24. };
  25. // Export createLibrary() function
  26. module.exports.createLibrary = function () {
  27. return lib.clone();
  28. };
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...