From 22c423f8b589e522ca2164d09cc97a7eec6e039d Mon Sep 17 00:00:00 2001 From: "Brian S. Stephan" Date: Mon, 26 Jul 2010 20:05:17 -0500 Subject: [PATCH] creating custom classes inheriting from irclib, in an attempt to figure out this unicode stuff and to do privmsg splitting eventually --- dr.botzo.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/dr.botzo.py b/dr.botzo.py index dcf0340..26bba91 100755 --- a/dr.botzo.py +++ b/dr.botzo.py @@ -555,6 +555,18 @@ class FactFile(Module): except NoOptionError: pass +class DrBotServerConnection(irclib.ServerConnection): + def privmsg(self, target, text): + """Send a PRIVMSG command.""" + # TODO: length limiting or splitting + self.send_raw("PRIVMSG %s :%s" % (target, text)) + +class DrBotIRC(irclib.IRC): + def server(self): + c = DrBotServerConnection(self) + self.connections.append(c) + return c + ##### # init ##### @@ -582,7 +594,7 @@ irclib.DEBUG = config.getboolean('IRC', 'debug') # start up the IRC bot # create IRC and server objects and connect -irc = irclib.IRC() +irc = DrBotIRC() server = irc.server().connect(botserver, botport, botnick, botircname) modlist = []