#NEWLINE# def run( self ) : #NEWLINE# #INDENT# irc_c = self . irc_c #NEWLINE# def _timers( irc_c ) : #NEWLINE# #INDENT# print ( 'Starting Timers Loop' ) #NEWLINE# while True : #NEWLINE# #INDENT# gevent . sleep ( 1 ) #NEWLINE# irc_c . timers ( irc_c ) #NEWLINE# #UNINDENT# #UNINDENT# if ( not isinstance ( sock . servers , list ) ) : #NEWLINE# #INDENT# self . servers = self . servers . split ( ',' ) #NEWLINE# #UNINDENT# while self . reconnect : #NEWLINE# #INDENT# sock = self . _try_connect ( ) #NEWLINE# if ( sock is None ) : #NEWLINE# #INDENT# gevent . sleep ( 10 ) #NEWLINE# print ( 'Retrying Server List...' ) #NEWLINE# continue #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# gevent . spawn ( raise_exceptions ( self . socket . run ) ) #NEWLINE# gevent . sleep ( 0 ) #NEWLINE# irc_c . events ( 'IRC_SOCKET_CONNECT' ) ( irc_c ) #NEWLINE# irc_c . bot_greenlets . spawn ( _timers , irc_c ) #NEWLINE# self . _fire_msg_events ( sock , irc_c ) #NEWLINE# #UNINDENT# except LineSocket . SocketError : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# self . socket . close ( ) #NEWLINE# print ( 'Giving Greenlets Time(1s) to die..' ) #NEWLINE# irc_c . bot_greenlets . join ( timeout = 1 ) #NEWLINE# #UNINDENT# except gevent . Timeout : #NEWLINE# #INDENT# print ( 'Killing Remaining Greenlets...' ) #NEWLINE# irc_c . bot_greenlets . kill ( ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# print ( 'Bot Dying.' )