From 549bac50cbb9d1dc3ee15cf7a9d84763352aee0f Mon Sep 17 00:00:00 2001 From: sbosse Date: Mon, 21 Jul 2025 23:37:58 +0200 Subject: [PATCH] Mon 21 Jul 22:43:21 CEST 2025 --- .../examples/reminder-bot/reminder-bot.js | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 js/ui/botui/examples/reminder-bot/reminder-bot.js diff --git a/js/ui/botui/examples/reminder-bot/reminder-bot.js b/js/ui/botui/examples/reminder-bot/reminder-bot.js new file mode 100644 index 0000000..3e92166 --- /dev/null +++ b/js/ui/botui/examples/reminder-bot/reminder-bot.js @@ -0,0 +1,53 @@ +var botui = new BotUI('reminder-bot'); + +botui.message + .bot('Would you like to add a reminder?') + .then(function () { + return botui.action.button({ + delay: 1000, + action: [{ + text: 'Yep', + value: 'yes' + }, { + text: 'Nope!', + value: 'no' + }] + }) +}).then(function (res) { + if(res.value == 'yes') { + showReminderInput(); + } else { + botui.message.bot('Okay.'); + } +}); + +var showReminderInput = function () { + botui.message + .bot({ + delay: 500, + content: 'Write your reminder below:' + }) + .then(function () { + return botui.action.text({ + delay: 1000, + action: { + placeholder: 'Buy some milk' + } + }) + }).then(function (res) { + botui.message + .bot({ + delay: 500, + content: 'reminder added: ' + res.value + }); + + return botui.action.button({ + delay: 1000, + action: [{ + icon: 'plus', + text: 'add another', + value: 'yes' + }] + }) + }).then(showReminderInput); +}