def reconnect(self): if self.debug: print("[DEBUG] Reconnecting...") self._sock.close() while not self.internet_on(): time.sleep( 1) #Wait for Internet conenction to re-establish (if WiFi..) self._sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self._sock.connect( (Util.config('server', self.debug), Util.config('port', self.debug))) self._sock.setblocking(0) self.join_channel() self.watch()
def __init__(self, debug=False): self.debug = debug self._currentUsers = [] self._server = IRCServer(self, debug) self._admin = Util.config('admin', debug) self._exitCode = Util.config('exitCode', debug) self._importantCode = Util.config('importantCode', debug) self._notifs = Util.config('notifications', debug) self._whitelist = Util.config('whitelist', debug) self._usesWhitelist = Util.config('usesWhitelist', debug) self._viplist = Util.config('viplist', debug) self._server.join_channel()
def __init__(self, callback, debug): self.debug = debug self._channel = Util.config('channel', debug) self._botName = Util.config('botName', debug) self.check_nickname() self._timeout = Util.config('receiveTimeout', debug) self._notifs = Util.config('notifications', debug) while not self.internet_on(): time.sleep(1) self._running = False self._sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self._sock.connect((Util.config('server', debug), Util.config('port', debug))) self._sock.setblocking(0) self._callback = callback