This depends on your application, if you are using a full-stack on top of python such as django, one choice is to have a background process
1) initial learning (or training of your application to discern known words related with good and bad; i.e. your application will need training data too)
2) continual learning (a mix of both supervised & unsupervised learning)
Application stack for your algorithm
-> django-celery can run as a background task processor (to help keep the algorithm up-to-date with new words and all that kind of stuff)
For the details, you'll probably want to use a naive-bayes classifier to classier chat streams as either positive/negative moods and respond appropriately.
Similar application frameworks can help you build that.