<s> from irc3 . plugins . command import command <EOL> import irc3 <EOL> @ irc3 . plugin <EOL> class MyPlugin : <EOL> """<STR_LIT>""" <EOL> requires = [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> ] <EOL> def __init__ ( self , bot ) : <EOL> self . bot = bot <EOL> self . log = self . bot . log <EOL> def connection_made ( self ) : <EOL> """<STR_LIT>""" <EOL> def server_ready ( self ) : <EOL> """<STR_LIT>""" <EOL> def connection_lost ( self ) : <EOL> """<STR_LIT>""" <EOL> @ irc3 . event ( irc3 . rfc . JOIN ) <EOL> def welcome ( self , mask , channel , ** kw ) : <EOL> """<STR_LIT>""" <EOL> if mask . nick != self . bot . nick : <EOL> self . bot . call_with_human_delay ( <EOL> self . bot . privmsg , channel , '<STR_LIT>' % mask . nick ) <EOL> else : <EOL> self . bot . call_with_human_delay ( <EOL> self . bot . privmsg , channel , "<STR_LIT>" ) <EOL> @ command <EOL> def echo ( self , mask , target , args ) : <EOL> """<STR_LIT>""" <EOL> self . bot . privmsg ( mask . nick , '<STR_LIT:U+0020>' . join ( args [ '<STR_LIT>' ] ) ) <EOL> @ command <EOL> def stats ( self , mask , target , args ) : <EOL> """<STR_LIT>""" <EOL> if args [ '<STR_LIT>' ] : <EOL> channel = args [ '<STR_LIT>' ] <EOL> target = mask . nick <EOL> else : <EOL> channel = target <EOL> if channel in self . bot . channels : <EOL> channel = self . bot . channels [ channel ] <EOL> message = '<STR_LIT>' . format ( len ( channel ) ) <EOL> for mode , nicknames in sorted ( channel . modes . items ( ) ) : <EOL> message += '<STR_LIT>' . format ( mode , len ( nicknames ) ) <EOL> self . bot . privmsg ( target , message ) <EOL> @ irc3 . extend <EOL> def my_usefull_method ( self ) : <EOL> """<STR_LIT>""" <EOL> def main ( ) : <EOL> config = dict ( <EOL> nick = '<STR_LIT>' , autojoins = [ '<STR_LIT>' ] , <EOL> host = '<STR_LIT>' , port = <NUM_LIT> , ssl = False , <EOL> includes = [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> __name__ , <EOL> ] <EOL> ) <EOL> bot = irc3 . IrcBot . from_config ( config ) <EOL> bot . run ( forever = True ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> main ( ) </s>
