diff --git a/zulip_botserver/README.md b/zulip_botserver/README.md index 4816aa0..5efbbea 100644 --- a/zulip_botserver/README.md +++ b/zulip_botserver/README.md @@ -1,9 +1,9 @@ ``` -zulip-bot-server --config-file --hostname
--port +zulip-botserver --config-file --hostname
--port ``` -Example: `zulip-bot-server --config-file ~/botserverrc` +Example: `zulip-botserver --config-file ~/botserverrc` This program loads the bot configurations from the config file (botserverrc here) and loads the bot modules. diff --git a/zulip_botserver/setup.py b/zulip_botserver/setup.py index f467f7d..5168e82 100644 --- a/zulip_botserver/setup.py +++ b/zulip_botserver/setup.py @@ -26,7 +26,7 @@ package_info = dict( url='https://www.zulip.org/', entry_points={ 'console_scripts': [ - 'zulip-bot-server=zulip_botserver.server:main', + 'zulip-botserver=zulip_botserver.server:main', ], }, test_suite='tests', diff --git a/zulip_botserver/tests/test_server.py b/zulip_botserver/tests/test_server.py index 604ae0e..2df3b9f 100644 --- a/zulip_botserver/tests/test_server.py +++ b/zulip_botserver/tests/test_server.py @@ -122,7 +122,7 @@ class BotServerTests(BotServerTestCase): token='abcd1234'), bots_config=bots_config)) - @mock.patch('sys.argv', ['zulip-bot-server', '--config-file', '/foo/bar/baz.conf']) + @mock.patch('sys.argv', ['zulip-botserver', '--config-file', '/foo/bar/baz.conf']) def test_argument_parsing_defaults(self) -> None: opts = parse_args() assert opts.config_file == '/foo/bar/baz.conf' diff --git a/zulip_botserver/zulip-botserver-supervisord.conf b/zulip_botserver/zulip-botserver-supervisord.conf index b6bf509..a7432b8 100644 --- a/zulip_botserver/zulip-botserver-supervisord.conf +++ b/zulip_botserver/zulip-botserver-supervisord.conf @@ -1,5 +1,5 @@ -[program:zulip-bot-server] -command=zulip-bot-server --config-file= --hostname
--port +[program:zulip-botserver] +command=zulip-botserver --config-file= --hostname
--port startsecs=3 stdout_logfile=/var/log/zulip_botserver.log ; all output of your Botserver will be logged here redirect_stderr=true diff --git a/zulip_botserver/zulip_botserver/input_parameters.py b/zulip_botserver/zulip_botserver/input_parameters.py index 3ff6a79..2d6a2fe 100644 --- a/zulip_botserver/zulip_botserver/input_parameters.py +++ b/zulip_botserver/zulip_botserver/input_parameters.py @@ -3,50 +3,41 @@ import argparse def parse_args() -> argparse.Namespace: usage = ''' - zulip-bot-server --config-file --hostname
--port - Example1: zulip-bot-server --config-file ~/botserverrc - Example2: zulip-bot-server --config-file ~/botserverrc -b mybotname - (This program loads the bot configurations from the - config file (botserverrc here) and loads the bot modules. - It then starts the server and fetches the requests to the - above loaded modules and returns the success/failure result) - Please make sure you have a current botserverrc file with the - configurations of the required bots. - Hostname and Port are optional arguments. Default hostname is - 127.0.0.1 and default port is 5002. - See lib/readme.md for more context. + zulip-botserver --config-file [--hostname=
] [--port=] ''' parser = argparse.ArgumentParser(usage=usage) parser.add_argument( - '--config-file', + '--config-file', '-c', action='store', required=True, - help='Config file for the zulip Botserver (botserverrc)' + help='Config file for the Botserver. Use your `botserverrc` for multiple bots or' + '`zuliprc` for a single bot.' ) parser.add_argument( '--bot-config-file', action='store', default=None, - help='Config file for third-party bots' + help='Config file for bots. Only needed when one of ' + 'the bots you want to run requires a config file.' ) parser.add_argument( '--bot-name', '-b', action='store', - help='Bot name (optional, rewrites first bot name from config file). ' - 'Only for single-bot usage! Other bots will be ignored' + help='Run a single bot BOT_NAME. Use this option to run the Botserver ' + 'with a `zuliprc` config file.' ) parser.add_argument( '--hostname', action='store', default="127.0.0.1", - help='Address on which you want to run the server' + help='Address on which you want to run the Botserver. (default: %(default)s)' ) parser.add_argument( '--port', action='store', default=5002, type=int, - help='Port on which you want to run the server' + help='Port on which you want to run the Botserver. (default: %(default)d)' ) return parser.parse_args()