Paulo Evan
Paulo Evan

Reputation: 15

AIML Bot Response According To Time

How to make bot response according to time? This is the code

<aiml>

<category>
<pattern>GOOD MORNING</pattern>
<template>
    <think><set name="hour"><date format="%H:%M"/></set></think>
    <condition name="hour">
        <li value="10:54">Hello and how are you this morning?</li>
        <li value="11:35">Hello and how are you this morning?</li>
    </condition>
</template>
</category>

</aiml>

I want my bot respond according to hour and minute how to do this? Is there anything wrong with the code

Upvotes: 0

Views: 78

Answers (1)

Steve Worswick
Steve Worswick

Reputation: 905

While that will work, you will need to make <li> tags for every minute of the day! You may also need to remove your : depending on your normalization file.

You only really need to check the hour though, the minute doesn't matter.

<category>
<pattern>GOOD MORNING</pattern>
<template>
<think><set name="hour"><date format="%H"/></set></think>
<condition name="hour">
    <li value="00">Hello, it's more like the middle of the night than morning.</li> 
    <li value="01">Hello, it's only just morning. How are you this morning?</li> 
    <li value="02">Hello, it's only just morning. How are you this morning?</li> 
    <li value="03">Hello and how are you this morning?</li> 
    <li value="04">Hello and how are you this morning?</li> 
    <li value="05">Hello and how are you this morning?</li> 
    <li value="06">Hello and how are you this morning?</li> 
    <li value="07">Hello and how are you this morning?</li> 
    <li value="08">Hello and how are you this morning?</li> 
    <li value="09">Hello and how are you this morning?</li> 
    <li value="10">Hello and how are you this morning?</li> 
    <li value="11">Hello and how are you this morning?</li> 
    <li value="12">You're a bit late. It's lunchtime here.</li> 
    <li value="13">You're a bit late. It's lunchtime here.</li> 
    <li value="14">Morning?! It's the afternoon here.</li> 
    <li value="15">Morning?! It's the afternoon here.</li> 
    <li value="16">Morning?! It's the afternoon here.</li> 
    <li value="17">Morning?! It's nearly evening.</li> 
    <li value="18">Morning?! It's evening here.</li> 
    <li value="19">Morning?! It's evening here.</li> 
    <li value="20">Morning?! It's evening here.</li> 
    <li value="21">Morning?! It's night time here.</li> 
    <li value="22">Morning?! It's night time here.</li> 
    <li value="23">Morning?! It's night time here.</li>
</condition>
</template>
</category>

Upvotes: 0

Related Questions