mostly stolen from twisted tutorial http://eflorenzano.com/blog/2008/11/17/writing-markov-chain-irc-bot-twisted-and-python/