[TASK] Disable privmsg reaction, add reconnect support.
This commit is contained in:
parent
3f82e07b45
commit
8f178acd5e
|
@ -33,6 +33,8 @@ class MonitorBot(irc.IRCClient):
|
|||
|
||||
def privmsg(self, user, channel, msg):
|
||||
"""Called when the bot receives a message."""
|
||||
pass
|
||||
"""
|
||||
sendTo = None
|
||||
prefix = ''
|
||||
senderNick = user.split('!', 1)[0]
|
||||
|
@ -55,6 +57,7 @@ class MonitorBot(irc.IRCClient):
|
|||
"sent message to {receiver}, triggered by {sender}:\n\t{reply}"
|
||||
.format(receiver=sendTo, sender=senderNick, reply=reply)
|
||||
)
|
||||
"""
|
||||
|
||||
class MonitorBotFactory(protocol.ClientFactory):
|
||||
protocol = MonitorBot
|
||||
|
@ -64,3 +67,11 @@ class MonitorBotFactory(protocol.ClientFactory):
|
|||
self.channel = channel
|
||||
self.nickname = nickname
|
||||
self.realname = realname
|
||||
|
||||
def clientConnectionLost(self, connector, reason):
|
||||
"""If we get disconnected, reconnect to server."""
|
||||
connector.connect()
|
||||
|
||||
def clientConnectionFailed(self, connector, reason):
|
||||
print "connection failed:", reason
|
||||
reactor.stop()
|
||||
|
|
|
@ -67,7 +67,6 @@ class MonitorBotService(Service):
|
|||
msg = "ftp> /%s (%s)" % (new_path, ', '.join(humanReadableMask(mask)))
|
||||
if msg not in self._messages:
|
||||
self._messages.append(msg)
|
||||
|
||||
self._callid = reactor.callLater(5.0, sendQueuedMessages)
|
||||
|
||||
def sendQueuedMessages():
|
||||
|
|
Loading…
Reference in New Issue