print "Usage: \ \n\tpyircbot.py [COMMAND] [FILE] [SERVER] [CHANNEL] [BOT NICK] [PASSWORD] \ \n\n\tCOMMAND: \ \n\t\t-h, --help\t\tHelp you are seeing right now \ \n\t\t-t, --testconfig\tTests [FILE] for being valid config file.\n\t\t\t\t\tIf no [FILE] specified use default (pyircbot.config) \ \n\n\tExample of usage: \ \n\n\tpython pyircbot.py irc.freenode.com:6667 \"#python\" ircbot secretpass \ \n\tConnects to irc.freenode.com at port 6667, join channel \"#python\" as ircbot and identify with password secretpass" sys.exit() # Runtime argument -t or --testconfig runs config file check if len(sys.argv) > 1 and (sys.argv[1] == "-t" or sys.argv[1] == "--testconfig"): # Second argument after -t or --testconfig should be config file path # if there's second argument parse it as config file, if not use default config file if len(sys.argv) == 3: Bot = BotController.BotController(sys.argv[2]) else: Bot = BotController.BotController() # Print config generated from config file print Bot.TestConfigurationFile() sys.exit() # There should be at least 4 and no more than 5 arguments to run the bot properly if len(sys.argv) < 4 and len(sys.argv) > 5: print "Invalid usage! Run script with flag -h or --help to see usage information." sys.exit() # Create Bot controller object Bot = BotController.BotController()