def __init__(self, my_pyborg, args): """ Args will be sys.argv (command prompt arguments) """ # PyBorg self.pyborg = my_pyborg # load settings self.settings = cfgfile.cfgset() self.settings.load("pyborg-irc.cfg", { "myname": ("The bot's nickname", "PyBorg"), "realname": ("Reported 'real name'", "Pyborg"), "owners": ("Owner(s) nickname", [ "OwnerNick" ]), "servers": ("IRC Server to connect to (server, port [,ssl on/off] [,password])", [("irc.starchat.net", 6667)]), "chans": ("Channels to auto-join", ["#test"]), "speaking": ("Allow the bot to talk on channels", 1), "stealth": ("Hide the fact we are a bot", 0), "ignorelist": ("Ignore these nicknames:", []), "reply2ignored": ("Reply to ignored people", 0), "replycommandprivmsg": ("Reply to commands via private message", 1), "loadurlmaxsize": ("Maximum size in bytes for the loadurl command", 1000000), "reply_chance": ("Chance of reply (%) per message", 33), "quitmsg": ("IRC quit message", "Bye :-("), "password": ("password for control the bot (Edit manually !)", ""), "speakingchans": ("Channels to speak in always", ['#test']) } ) self.owners = self.settings.owners[:] self.chans = self.settings.chans[:] # Parse command prompt parameters for x in xrange(1, len(args)): # Specify servers if args[x] == "-s": self.settings.servers = [] # Read list of servers for y in xrange(x+1, len(args)): if args[y][0] == "-": break server = args[y].split(":") # Default port if none specified if len(server) == 1: server.append("6667") self.settings.servers.append( (server[0], int(server[1])) ) # Channels if args[x] == "-c": self.settings.chans = [] # Read list of channels for y in xrange(x+1, len(args)): if args[y][0] == "-": break self.settings.chans.append("#"+args[y]) # Nickname if args[x] == "-n": try: self.settings.myname = args[x+1] except IndexError: pass
def __init__(self, my_pyborg, args): """ Args will be sys.argv (command prompt arguments) """ # PyBorg self.pyborg = my_pyborg # load settings self.settings = cfgfile.cfgset() self.settings.load("pyborg-msn.cfg", { "myname": ("The bot's nickname", "PyBorg"), "msn_passport": ("Reported passport account", "*****@*****.**"), "msn_password": ("Reported password account", "password"), "owners": ("Owner(s) passport account", [ "*****@*****.**" ]), "password": ("password for control the bot (Edit manually !)", "") } ) self.owners = self.settings.owners[:]
def __init__(self, my_pyborg, args): """ Args will be sys.argv (command prompt arguments) """ # PyBorg self.pyborg = my_pyborg # load settings self.settings = cfgfile.cfgset() self.settings.load( "pyborg-irc.cfg", { "myname": ("The bot's nickname", "PyBorg"), "realname": ("Reported 'real name'", "Pyborg"), "owners": ("Owner(s) nickname", ["OwnerNick"]), "servers": ("IRC Server to connect to (server, port [,ssl on/off] [,password])", [("irc.starchat.net", 6667)]), "chans": ("Channels to auto-join", ["#test"]), "speaking": ("Allow the bot to talk on channels", 1), "stealth": ("Hide the fact we are a bot", 0), "ignorelist": ("Ignore these nicknames:", []), "reply2ignored": ("Reply to ignored people", 0), "replycommandprivmsg": ("Reply to commands via private message", 1), "loadurlmaxsize": ("Maximum size in bytes for the loadurl command", 1000000), "reply_chance": ("Chance of reply (%) per message", 33), "quitmsg": ("IRC quit message", "Bye :-("), "password": ("password for control the bot (Edit manually !)", ""), "speakingchans": ("Channels to speak in always", ['#test']) }) self.owners = self.settings.owners[:] self.chans = self.settings.chans[:] # Parse command prompt parameters for x in xrange(1, len(args)): # Specify servers if args[x] == "-s": self.settings.servers = [] # Read list of servers for y in xrange(x + 1, len(args)): if args[y][0] == "-": break server = args[y].split(":") # Default port if none specified if len(server) == 1: server.append("6667") self.settings.servers.append((server[0], int(server[1]))) # Channels if args[x] == "-c": self.settings.chans = [] # Read list of channels for y in xrange(x + 1, len(args)): if args[y][0] == "-": break self.settings.chans.append("#" + args[y]) # Nickname if args[x] == "-n": try: self.settings.myname = args[x + 1] except IndexError: pass