Perform Tasks Periodically With Python Irc Library
Is there a way to automate periodic tasks: like sending messages to other users or channels, etc. using python irclib or twisted-based youmomdotcom python irc bot. Example of ircl
Solution 1:
If you use the Twisted-based solution, you can simply use a LoopingCall
to schedule whatever periodic method you want to call.
(If you use irclib it's much harder to do this in a way that works properly in all situations, so I will not include that in my answer here.)
Solution 2:
As Glyph pointed out, i've overridden the instance method connectionMade of the irc client class and made it use LoopingCall.
def connectionMade(self):
irc.IRCClient.connectionMade(self)
task.LoopingCall(lambda : (self.msg(counterpartID, "hi there"))).start(5.0)
Post a Comment for "Perform Tasks Periodically With Python Irc Library"