def run(): usage = ''' ./run.py <lib file> Example: ./run.py lib/followup.py (This program loads bot-related code from the library code and then runs a message loop, feeding messages to the library code to handle.) Please make sure you have a current ~/.zuliprc file with the credentials you want to use for this bot. See lib/readme.md for more context. ''' parser = optparse.OptionParser(usage=usage) parser.add_option('--quiet', '-q', action='store_true', help='Turn off logging output.') parser.add_option('--config-file', action='store', help='(alternate config file to ~/.zuliprc)') (options, args) = parser.parse_args() if len(args) == 0: print('You must specify a library!') sys.exit(1) lib_module = get_lib_module(bots_fn=args[0]) if not options.quiet: logging.basicConfig(stream=sys.stdout, level=logging.INFO) run_message_handler_for_bot(lib_module=lib_module, config_file=options.config_file, quiet=options.quiet)
def run(): usage = ''' ./run.py <lib file> Example: ./run.py lib/followup.py (This program loads bot-related code from the library code and then runs a message loop, feeding messages to the library code to handle.) Please make sure you have a current ~/.zuliprc file with the credentials you want to use for this bot. See lib/readme.md for more context. ''' parser = optparse.OptionParser(usage=usage) parser.add_option('--quiet', '-q', action='store_true', help='Turn off logging output.') parser.add_option('--config-file', action='store', help='(alternate config file to ~/.zuliprc)') (options, args) = parser.parse_args() if len(args) == 0: print('You must specify a library!') sys.exit(1) lib_module = get_lib_module(lib_fn=args[0]) if not options.quiet: logging.basicConfig(stream=sys.stdout, level=logging.INFO) run_message_handler_for_bot( lib_module=lib_module, config_file=options.config_file, quiet=options.quiet )