<s> """<STR_LIT>""" <EOL> __version__ = '<STR_LIT>' <EOL> import random <EOL> import thread <EOL> import threading <EOL> import time <EOL> import rciw <EOL> import censure <EOL> import wikipedia as pywikibot <EOL> import externals <EOL> externals . check_setup ( '<STR_LIT>' ) <EOL> from ircbot import SingleServerIRCBot <EOL> from irclib import nm_to_n <EOL> ver = <NUM_LIT:1> <EOL> site = pywikibot . getSite ( ) <EOL> site . forceLogin ( ) <EOL> class rcFeeder ( SingleServerIRCBot ) : <EOL> def __init__ ( self , channel , nickname , server , port = <NUM_LIT> ) : <EOL> SingleServerIRCBot . __init__ ( self , [ ( server , port ) ] , nickname , nickname ) <EOL> self . channel = channel <EOL> self . rcbot = rciw . IWRCBot ( site ) <EOL> self . tasks = [ ] <EOL> def on_nicknameinuse ( self , c , e ) : <EOL> c . nick ( c . get_nickname ( ) + "<STR_LIT:_>" ) <EOL> def on_welcome ( self , c , e ) : <EOL> c . join ( self . channel ) <EOL> def on_privmsg ( self , c , e ) : <EOL> pass <EOL> def on_pubmsg ( self , c , e ) : <EOL> try : <EOL> msg = unicode ( e . arguments ( ) [ <NUM_LIT:0> ] , '<STR_LIT:utf-8>' ) <EOL> except UnicodeDecodeError : <EOL> return <EOL> name = msg [ <NUM_LIT:8> : msg . find ( u'<STR_LIT>' , <NUM_LIT:9> ) ] <EOL> if '<STR_LIT>' in self . tasks : <EOL> self . rcbot . addQueue ( name ) <EOL> if '<STR_LIT>' in self . tasks : <EOL> thread . start_new_thread ( censure . checkPage , ( name , True ) ) <EOL> def on_dccmsg ( self , c , e ) : <EOL> pass <EOL> def on_dccchat ( self , c , e ) : <EOL> pass <EOL> def on_quit ( self , e , cmd ) : <EOL> pass <EOL> class MaintcontBot ( SingleServerIRCBot ) : <EOL> def __init__ ( self , nickname , server , port = <NUM_LIT> ) : <EOL> SingleServerIRCBot . __init__ ( self , [ ( server , port ) ] , nickname , nickname ) <EOL> feederThread = threading . Thread ( target = self . feederBot ) <EOL> feederThread . setDaemon ( True ) <EOL> feederThread . start ( ) <EOL> def feederBot ( self ) : <EOL> self . feed = rcFeeder ( '<STR_LIT>' % ( site . language ( ) , site . family . name ) , <EOL> site . loggedInAs ( ) , "<STR_LIT>" ) <EOL> self . feed . start ( ) <EOL> def on_nicknameinuse ( self , c , e ) : <EOL> c . nick ( "<STR_LIT>" + str ( random . randrange ( <NUM_LIT:100> , <NUM_LIT> ) ) ) <EOL> def on_welcome ( self , c , e ) : <EOL> self . connection . privmsg ( "<STR_LIT>" , <EOL> "<STR_LIT>" <EOL> % ( site . language ( ) , site . family . name , <EOL> str ( ver ) ) ) <EOL> def on_privmsg ( self , c , e ) : <EOL> nick = nm_to_n ( e . source ( ) ) <EOL> c = self . connection <EOL> cmd = e . arguments ( ) [ <NUM_LIT:0> ] <EOL> do = cmd . split ( ) <EOL> if do [ <NUM_LIT:0> ] == "<STR_LIT>" : <EOL> print "<STR_LIT>" <EOL> thread . start_new_thread ( self . activator , ( ) ) <EOL> elif do [ <NUM_LIT:0> ] == "<STR_LIT>" and len ( do ) > <NUM_LIT:1> : <EOL> self . feed . tasks = do [ <NUM_LIT:1> ] . split ( '<STR_LIT:|>' ) <EOL> def on_dccmsg ( self , c , e ) : <EOL> pass <EOL> def on_dccchat ( self , c , e ) : <EOL> pass <EOL> def activator ( self ) : <EOL> while True : <EOL> self . connection . privmsg ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> time . sleep ( <NUM_LIT:10> ) <EOL> class Maintainer : <EOL> def __init__ ( self ) : <EOL> controllThread = threading . Thread ( target = self . controllBot ) <EOL> controllThread . setDaemon ( True ) <EOL> controllThread . start ( ) <EOL> while True : <EOL> raw_input ( ) <EOL> def controllBot ( self ) : <EOL> bot = MaintcontBot ( "<STR_LIT>" % str ( random . randrange ( <NUM_LIT:100> , <NUM_LIT> ) ) , <EOL> "<STR_LIT>" ) <EOL> bot . start ( ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> Maintainer ( ) </s>
