newbot-prompts

1.0.1 • Public • Published

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

  1. In your skill, import the package
  2. 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 }
} 

Readme

Keywords

none

Package Sidebar

Install

npm i newbot-prompts

Weekly Downloads

9

Version

1.0.1

License

MIT

Unpacked Size

861 kB

Total Files

18

Last publish

Collaborators

  • webcreative5