From 762118bbea6326b52bcf843b0bcac429e2481365 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20H=C3=B6nig?= Date: Tue, 29 May 2018 10:19:50 +0200 Subject: [PATCH] Rename flaskbotrc to botserverrc. --- .gitignore | 4 ++-- zulip_botserver/README.md | 8 ++++---- zulip_botserver/tests/test_server.py | 2 +- zulip_botserver/zulip-botserver-supervisord.conf | 2 +- zulip_botserver/zulip_botserver/input_parameters.py | 12 ++++++------ zulip_botserver/zulip_botserver/server.py | 4 ++-- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/.gitignore b/.gitignore index 4ae2fe0..7a61021 100644 --- a/.gitignore +++ b/.gitignore @@ -41,8 +41,8 @@ zulip_bots/MANIFEST.in # Bot configuration files zuliprc .zuliprc -flaskbotrc -.flaskbotrc +botserverrc +.botserverrc # mypy .mypy_cache diff --git a/zulip_botserver/README.md b/zulip_botserver/README.md index 30317e2..4816aa0 100644 --- a/zulip_botserver/README.md +++ b/zulip_botserver/README.md @@ -1,16 +1,16 @@ ``` -zulip-bot-server --config-file --hostname
--port +zulip-bot-server --config-file --hostname
--port ``` -Example: `zulip-bot-server --config-file ~/flaskbotrc` +Example: `zulip-bot-server --config-file ~/botserverrc` This program loads the bot configurations from the -config file (flaskbotrc here) and loads the bot modules. +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 flaskbotrc file with the +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. diff --git a/zulip_botserver/tests/test_server.py b/zulip_botserver/tests/test_server.py index 29c117e..f0b221c 100644 --- a/zulip_botserver/tests/test_server.py +++ b/zulip_botserver/tests/test_server.py @@ -88,7 +88,7 @@ class BotServerTests(BotServerTestCase): six.assertRaisesRegex(self, ImportError, "Bot \"nonexistent-bot\" doesn't exists. Please " - "make sure you have set up the flaskbotrc file correctly.", + "make sure you have set up the botserverrc file correctly.", lambda: self.assert_bot_server_response( available_bots=available_bots, event=dict(message={'content': "@**test** test message"}, diff --git a/zulip_botserver/zulip-botserver-supervisord.conf b/zulip_botserver/zulip-botserver-supervisord.conf index 7083689..3039cd4 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 +command=zulip-bot-server --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 691a865..3443d46 100644 --- a/zulip_botserver/zulip_botserver/input_parameters.py +++ b/zulip_botserver/zulip_botserver/input_parameters.py @@ -3,14 +3,14 @@ import argparse def parse_args() -> argparse.Namespace: usage = ''' - zulip-bot-server --config-file --hostname
--port - Example1: zulip-bot-server --config-file ~/flaskbotrc - Example2: zulip-bot-server --config-file ~/flaskbotrc -b mybotname + 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 (flaskbotrc here) and loads the bot modules. + 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 flaskbotrc file with the + 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. @@ -22,7 +22,7 @@ def parse_args() -> argparse.Namespace: '--config-file', action='store', required=True, - help='Config file for the zulip bot server (flaskbotrc)' + help='Config file for the zulip bot server (botserverrc)' ) parser.add_argument( '--bot-config-file', diff --git a/zulip_botserver/zulip_botserver/server.py b/zulip_botserver/zulip_botserver/server.py index 34ae537..b5022ff 100644 --- a/zulip_botserver/zulip_botserver/server.py +++ b/zulip_botserver/zulip_botserver/server.py @@ -56,7 +56,7 @@ def load_lib_modules(available_bots: List[str]) -> Dict[str, Any]: except ImportError: raise ImportError( "\nImport Error: Bot \"{}\" doesn't exists. " - "Please make sure you have set up the flaskbotrc file correctly.\n".format(bot) + "Please make sure you have set up the botserverrc file correctly.\n".format(bot) ) return bots_lib_module @@ -110,7 +110,7 @@ def handle_bot() -> Union[str, BadRequest]: break else: return BadRequest("Cannot find a bot with email {} in the bot server " - "configuration file. Do the emails in your flaskbotrc " + "configuration file. Do the emails in your botserverrc " "match the bot emails on the server?".format(event['bot_email'])) lib_module = app.config.get("BOTS_LIB_MODULES", {})[bot] bot_handler = app.config.get("BOT_HANDLERS", {})[bot]