My speech bot, using

Okay, revamped the basic idea, now using the irclib, which in spite of a lack of documentation, actually proved to be pretty easy to use. You should be able to figure out what it does, and modify it to use your own nicks and channel.

#!/usr/bin/env python

import sys
import os
import optparse
import irclib

network = ""
port = 6667
channel = "#somechannel"
nick = "SomeNick"
name = "SomeNick is a bot."

irc = irclib.IRC()
server = irc.server()
server.connect(network, port, nick, ircname = name)

lastspeaker = None

def handlePubMessage(connection, event):
        global lastspeaker
        target =
        speaker = event.source().split('!')[0]
        msg = event.arguments()[0]
        print target, ">", speaker, ":", msg
        p = os.popen("festival --tts", "w")
        if speaker != lastspeaker:
                p.write(speaker + " says ")
        lastspeaker = speaker

irc.add_global_handler('pubmsg', handlePubMessage)