def main(argv): fileConfig = "config.json" try: opts, args = getopt.getopt(argv, "vhc:", ["version", "help", "config="]) if opts != None and args != None: for opt, arg in opts: if opt in ("-v", "--version"): print info.botabout() sys.exit() elif opt in ("-h", "--help"): print help_message sys.exit() elif opt in ("-c", "--config"): fileConfig = arg except getopt.GetoptError: print help_message sys.exit(2) print " Starting up {0}".format(info.botaboutshort()) print "===========================" print "Using '{0}' as the configuration file...\n".format(fileConfig) config = loadConfig(fileConfig) commandcore.cacheBuiltin() general = generalConfig(config) server = serverConfig(config) channels = channelcore.loadChannels(config) bots = {} for c in channels.values(): bots[c.name] = ChatBot(general, server, c) thread.start_new_thread(bots[c.name].run, ()) while True: time.sleep(1)
def doVersion(): return info.botaboutshort()