સુધારો કરવા માટે અમારા Platinum સેવા અને અમને બિલ્ડ તમારા બોટ માટે તમે
Bot Libre Forum : User's input

RE: User's input

દ્વારા admin પોસ્ટ May 25 2016, 13:46

You can use patterns and templates from the "Training & Chat Logs" page.
This lets you do a basic level of programmatic processing.
You can also do more advanced things from the "Scripts" page by writing your own script.

To reuse part of a pattern in a response use the "star" variable. If you have multiple * in the pattern star becomes an array, so use star[0], etc.

You need to prefix patterns with Pattern("") and templates with Template("").
To use a variable or code in a template use {}.

Examples:

Pattern("Do you like *?")
Template("Yes I like {star} very much.")

Pattern("Do you like * or *?")
Template("I like {star[0]} but I don't like {star[1]}.")

What is the date today?
Template("It is {Date.date()}.")

For inputting a number you probably want to use a script, but may be able to use a response with a default response with a previous as well.

Scripts are more complex, they are written is Self, which uses states and patterns. Self follows the JavaScript syntax.

state EnterCode { pattern "*" that "Please enter your code." template checkCode(); pattern "*" template "Please enter your code."; function checkCode() { if (star.startsWith("07")) { return "Welcome 07 user"; } else if (star.startsWith("06")) { return "Welcome 06 user"; } return "Invalid code"; } }


See also,

Self
https://www.botlibre.com/forum-post?id=705860

Patterns
https://www.botlibre.com/forum-post?id=15948

Templates
https://www.botlibre.com/forum-post?id=16008

Also check out examples in our script library, and it your bot's bootstrap scripts.


ને: 12821339
પોસ્ટ: May 25 2016, 13:46
સુધારાશે: May 26 2016, 9:23
જવાબો: 0
જોવાઈ: 2611, આજે: 1, સપ્તાહ: 3, મહિને: 9
0 0 0.0/5