The middlewares
Functions are triggered during the script interpretation cycle. Let's use the use()
method in javascript
const converse = new NewBot()
// ...
converse.use({
sending(input, output, { user, data }, next) {
next()
},
finished(input, { user, data }) {
},
prompt(input, params, { user, data }) {
},
nothing(input) {
}
})
sending()
is executed as soon as a message is sent by the script.finished()
is executed when the scenario is finishedprompt()
is executed when the user is prompted to enter a messagenothing()
is executed when nothing is triggered in the script
Last updated
Was this helpful?