self.add_event_handler('message', self.message)
self.add_event_handler('got_online', self._view)
+ # Handles disconnection
+ self.add_event_handler('disconnected', self.disconn)
+
# Discover bot internal command (ie. help)
for name, value in inspect.getmembers(self):
if inspect.ismethod(value) and \
self.log.setLevel(log_level)
self.log.debug('set logger, log level : %s', log_level)
+ def disconn(self, event):
+ """disconnected handler"""
+ msg = ": %s" % event if event else "‽"
+ self.log.info('Disconnected from server%s', msg)
+ self.connect()
+
def message(self, msg):
"""Messages handler