<s> import supybot . conf as conf <EOL> from supybot . commands import * <EOL> import supybot . plugins as plugins <EOL> import supybot . ircutils as ircutils <EOL> from supybot . i18n import PluginInternationalization , internationalizeDocstring <EOL> _ = PluginInternationalization ( '<STR_LIT>' ) <EOL> class Success ( plugins . ChannelIdDatabasePlugin ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , irc ) : <EOL> self . __parent = super ( Success , self ) <EOL> self . __parent . __init__ ( irc ) <EOL> self . target = None <EOL> pluginSelf = self <EOL> self . originalClass = conf . supybot . replies . success . __class__ <EOL> class MySuccessClass ( self . originalClass ) : <EOL> def __call__ ( self ) : <EOL> ret = pluginSelf . db . random ( dynamic . msg . args [ <NUM_LIT:0> ] ) <EOL> if ret is None : <EOL> try : <EOL> self . __class__ = pluginSelf . originalClass <EOL> ret = self ( ) <EOL> finally : <EOL> self . __class__ = MySuccessClass <EOL> else : <EOL> ret = ret . text <EOL> return ret <EOL> def get ( self , attr ) : <EOL> if ircutils . isChannel ( attr ) : <EOL> pluginSelf . target = attr <EOL> return self <EOL> conf . supybot . replies . success . __class__ = MySuccessClass <EOL> def die ( self ) : <EOL> self . __parent . die ( ) <EOL> conf . supybot . replies . success . __class__ = self . originalClass <EOL> Success = internationalizeDocstring ( Success ) <EOL> Class = Success </s>
