-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbot.xml
17 lines (15 loc) · 838 Bytes
/
bot.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<context>
<input pattern="(hi|hello) *">
<!-- Greet the user if we know his/her name -->
<output value="Hello $UserName!" if="full($UserName)"/>
<!-- Or activate an inner context to ask the user about his/her name -->
<context if="empty($UserName)" modal="true"> <!-- We use a modal context, so our bot will recognize any text as the user’s name -->
<output value="Hi! What is your name?"/>
<input pattern="$Text">
<!-- Store the user’s name in the UserName variable with "user" scope to save it into database -->
<var name="UserName" value="$Text" scope="user"/>
<output value="Nice to meet you, $UserName!"/> <!-- Using the placeholder in output -->
</input>
</context>
</input>
</context>