[Twisted-Python] IRCClient (ircLogBot.py) send a message every 5 minutes

Laurens Vets laurens at daemon.be
Thu Mar 26 12:18:29 MDT 2015


Hello,

I'm trying to get to know the Twisted framework by extending the 
ircLogBot.py example. I want to be able to get a list of all names in a 
channel (by sending NAMES) and I want to rerun this every 5 minutes.

I've been able to get the NAMES on a channel join by doing this in 
LogBot:

def joined(self, channel):
     self.names(channel)

def names(self, channel):
     self.sendLine("NAMES %s" % channel)

def irc_unknown(self, prefix, command, params):
     if command == 'RPL_NAMREPLY':
         self.handle_namereply(*params)

def handle_namereply(self, myname, channeltype, channelname, users):
     self.logger.log("Handling namereply %r %r %r %r" % (myname, 
channeltype, channelname, users))

The problem I face is that I have no idea where to put a LoopingCall to 
run this same command every 5 minutes. Where would be the best place to 
place this?

Thanks in advance!



More information about the Twisted-Python mailing list