<s> from plugins . util import admin , command , humanize_list <EOL> @ admin ( "<STR_LIT>" ) <EOL> def setcommand ( m ) : <EOL> """<STR_LIT>""" <EOL> if len ( m . line ) > <NUM_LIT:4> : <EOL> m . bot . private_message ( m . location , <EOL> '<STR_LIT>' ) <EOL> return <EOL> if len ( m . line ) <= <NUM_LIT:3> : <EOL> chan = m . location <EOL> elif len ( m . line ) == <NUM_LIT:4> : <EOL> if m . line [ <NUM_LIT:3> ] [ <NUM_LIT:0> ] != "<STR_LIT:#>" : <EOL> m . bot . private_message ( m . location , '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> return <EOL> chan = m . line [ <NUM_LIT:3> ] <EOL> if not chan in m . bot . configuration [ "<STR_LIT>" ] : <EOL> m . bot . private_message ( m . location , <EOL> "<STR_LIT>" . format ( <EOL> chan ) ) <EOL> return <EOL> settings = m . bot . configuration [ "<STR_LIT>" ] [ chan ] [ "<STR_LIT>" ] <EOL> if len ( m . line ) == <NUM_LIT:1> : <EOL> if not settings : <EOL> m . bot . private_message ( m . location , "<STR_LIT>" . format ( chan ) ) <EOL> else : <EOL> m . bot . private_message ( m . location , ( "<STR_LIT:U+0020>" . join ( <EOL> map ( lambda s : ( '<STR_LIT>' . format ( s [ <NUM_LIT:0> ] , s [ <NUM_LIT:1> ] ) ) , <EOL> iter ( settings . items ( ) ) ) ) ) ) <EOL> elif len ( m . line ) == <NUM_LIT:2> : <EOL> if not settings or m . line [ <NUM_LIT:1> ] not in settings : <EOL> m . bot . private_message ( m . location , <EOL> '<STR_LIT>' . format ( m . line [ <NUM_LIT:1> ] , chan ) ) <EOL> else : <EOL> m . bot . private_message ( m . location , <EOL> '<STR_LIT>' . format ( m . line [ <NUM_LIT:1> ] , <EOL> settings [ m . line [ <NUM_LIT:1> ] ] , chan ) ) <EOL> else : <EOL> setting = m . line [ <NUM_LIT:1> ] . lower ( ) <EOL> value = m . line [ <NUM_LIT:2> ] . lower ( ) <EOL> m . bot . configuration [ "<STR_LIT>" ] [ chan ] [ "<STR_LIT>" ] [ setting ] = value <EOL> m . bot . update_configuration ( m . bot . configuration ) <EOL> m . bot . logger . info ( <EOL> '<STR_LIT>' . format ( setting , value , chan , m . sender ) ) <EOL> m . bot . private_message ( m . location , '<STR_LIT>' . format ( setting , value , chan ) ) <EOL> @ admin ( ) <EOL> def unset ( m ) : <EOL> """<STR_LIT>""" <EOL> if len ( m . line ) != <NUM_LIT:2> and not ( len ( m . line ) == <NUM_LIT:3> and m . line [ <NUM_LIT:2> ] [ <NUM_LIT:0> ] == "<STR_LIT:#>" ) : <EOL> m . bot . private_message ( m . location , <EOL> '<STR_LIT>' ) <EOL> return <EOL> chan = m . location if len ( m . line ) == <NUM_LIT:2> else m . line [ <NUM_LIT:2> ] <EOL> if chan not in m . bot . configuration [ "<STR_LIT>" ] : <EOL> m . bot . private_message ( m . location , <EOL> "<STR_LIT>" . format ( <EOL> chan ) ) <EOL> return <EOL> try : <EOL> del m . bot . configuration [ "<STR_LIT>" ] [ chan ] [ "<STR_LIT>" ] [ m . line [ <NUM_LIT:1> ] ] <EOL> m . bot . update_configuration ( m . bot . configuration ) <EOL> except KeyError : <EOL> pass <EOL> m . bot . private_message ( m . location , '<STR_LIT>' . format ( m . line [ <NUM_LIT:1> ] , chan ) ) </s>
