Save the user's progress
If the user has already started the scenario, it would be nice not to have him start the conversation again from scratch.
Take the following scenario:
With the help of a middleware, we can recover the progress of the user
Here, when the user arrives at the request of a text input (that is, when the user arrives at Prompt()
in the scenario), his progress is saved in the constant json
We can save the content in a database like MongoDB, CouchDB, etc.
Load user data
It is good to load a set of users. Suppose each db.users()
below is a call to the database to retrieve a collection of data
Browser example with localStorage
Assuming that path/dist/browser.js
is the path to the generated file after doing newbot build
Here we notice: 1. We load the user initially if, of course, we have a record in localStorage
2. We use the finished
middleware to register the current user in localStorage
::: tip User ID On the server side, let us indicate the username of the user when using the .exec()
method.
Last updated