Does anyone know how to write oop chat bot?

I need help creating a simple chat bot with oop as3 scripting. I want to know how write the bot chat and finding the poporties when is find the name and change it into a real name.

person say: hi
bot say: hi
person: what your name?
bot say: my name is bot.