I'm not shure what you looking for, but one way to do it is like:
!learn bla is bla bla
!learn hello is hi there, how are you $nick
then make the bot store the lines in a *.txt file, and when ever a word is said on the channel, lets say hello, then the bot reply to that user "hi there, how are you $nick", is this what you looking for?