📃
NewBot
  • NewBot, what is it?
  • ConverseScript Syntax
    • Variables
    • Arithmetic
    • Boolean
    • Array and object
    • Entering text and output
    • Magic variables
    • Condition
    • Loop
    • Functions
    • The decorators
      • Use @Condition
      • Use @Action
      • Use @Format
      • Use @Intent
      • Use @Event
  • Prebuilt Formats for Widget
    • Quick Replies
    • Multi Cards
    • Articles
    • Form
  • Pre-built function for the widget
    • Request()
    • Map()
    • _ (lodash)
  • Get Started with Framework
    • Install
    • Main Skill
    • Write the conversational script
  • Use NewBot Framework JS
    • Create a skill (more details)
      • Relationship between skills
      • Use the functions of a child competency
      • Conditional
      • Control access to a skill
    • Create a JavaScript function and trigger it in ConverseScript
    • The constants
    • Write formats
      • Write and use multi-formats
      • Share formats
    • Internationalization (i18n)
    • Set up an NLP system
      • Share the NLP system
      • Use DialogFlow
    • Deploy on the browser
    • Run the chatbot on NodeJS
    • Send data when running the chatbot
    • The middlewares
    • Save the user's progress
    • User object
  • Unit Tests
    • Test a scenario
    • Test variables
    • Spy a function
    • Create a mock
    • Test the events
    • Test the actions
Powered by GitBook
On this page
  • Parent-Child
  • Sisters
  • In the same skill

Was this helpful?

  1. Use NewBot Framework JS
  2. Create a skill (more details)

Relationship between skills

Parent-Child

Let's say two skills have the same trigger

@Intent(/hello/i)
hello() {
    > Hey
}

If the user says "hello", only the child skill will be triggered. The parent skill has been "overloaded" by the child's skill

Event "nothing"

Here are two codes

parent.converse

@Intent(/hello/i)
hello() {
    > Hey
}

@Event('nothing')
nothing() {
    > What ?
}

child.converse

@Intent(/bye/i)
bye() {
    > Bye
}

If the user says "bye", the chatbot responds "Bye" with the child skill.

Even if no function is triggered in the parent skill, the nothing event is not executed because a child skill has been triggered

If the user says "good", the chatbot responds "What?" Because no child and parent skills function has been triggered.

Sisters

Two sister skills (ie having the same parent)

import oneSkill from './skills/one-skill/one-skill'
import secondSkill from './skills/second-skill/second-skill'

export default {
    skills: {
        oneSkill,
        secondSkill
    }
}

If both skills have the same trigger:

@Intent(/hello/i)
hello() {
    > Hey
}

Both will be triggered at the same time

In the same skill

If the skill has this code:

@Intent(/hello/i)
helloWorld() {
    > Hey Boy
}

@Intent(/hello (world)?/i)
hello() {
    > Hey World
}

If the user says "hello", both intentions are concerned but only the first one written (the function helloWorld()) will be triggered

If the user says "hello world", only the second intention (the function undefined) is concerned and will be triggered

PreviousCreate a skill (more details)NextUse the functions of a child competency

Last updated 3 years ago

Was this helpful?