Dark Michou is a working PHP/Python model for a Markov-chain-style bot that learns and posts on IRC channels.
It's fairly simple to use, but if you're looking for a robust solution, there's probably a lot of much better choices.