newbot-prompts
v1.0.1
Published
Ask the user to enter text in a specific format
Downloads
12
Readme
Description
Ask the user to enter text in a specific format. the chatbot can ask for :
- An email
- A phone number
- A date
- A confirmation
- A number
Installation
Install with
npm install newbot-prompts
Use
- In your skill, import the package
- Add the skill in the
skills
import prompts from 'newbot-prompts'
import code from './main.converse'
export default {
code,
skills: {
prompts
}
}
Use in ConverseScript
In main.converse
:
Ask email
myFunction() {
email = prompts.email()
> { email }
}
Ask Phone
myFunction() {
phone = prompts.phone()
> { phone }
}
Ask Date
myFunction() {
date = prompts.time('Give a date')
> { date }
}
Ask Number
myFunction() {
number = prompts.number('Give a number')
> { number }
}
You can put a minimum and/or maximum :
myFunction() {
number = prompts.number('Give a number', {
min: 0,
max: 100
})
> { number }
}
Ask Confirmation
myFunction() {
bool = prompts.confirm('Do you want to buy?')
> { bool }
}