Rename flaskbotrc to botserverrc.
This commit is contained in:
parent
3859bef05f
commit
762118bbea
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -41,8 +41,8 @@ zulip_bots/MANIFEST.in
|
||||||
# Bot configuration files
|
# Bot configuration files
|
||||||
zuliprc
|
zuliprc
|
||||||
.zuliprc
|
.zuliprc
|
||||||
flaskbotrc
|
botserverrc
|
||||||
.flaskbotrc
|
.botserverrc
|
||||||
|
|
||||||
# mypy
|
# mypy
|
||||||
.mypy_cache
|
.mypy_cache
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
```
|
```
|
||||||
zulip-bot-server --config-file <path to flaskbotrc> --hostname <address> --port <port>
|
zulip-bot-server --config-file <path to botserverrc> --hostname <address> --port <port>
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Example: `zulip-bot-server --config-file ~/flaskbotrc`
|
Example: `zulip-bot-server --config-file ~/botserverrc`
|
||||||
|
|
||||||
This program loads the bot configurations from the
|
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
|
It then starts the server and fetches the requests to the
|
||||||
above loaded modules and returns the success/failure result.
|
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.
|
configurations of the required bots.
|
||||||
Hostname and Port are optional arguments. Default hostname is
|
Hostname and Port are optional arguments. Default hostname is
|
||||||
127.0.0.1 and default port is 5002.
|
127.0.0.1 and default port is 5002.
|
||||||
|
|
|
@ -88,7 +88,7 @@ class BotServerTests(BotServerTestCase):
|
||||||
six.assertRaisesRegex(self,
|
six.assertRaisesRegex(self,
|
||||||
ImportError,
|
ImportError,
|
||||||
"Bot \"nonexistent-bot\" doesn't exists. Please "
|
"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(
|
lambda: self.assert_bot_server_response(
|
||||||
available_bots=available_bots,
|
available_bots=available_bots,
|
||||||
event=dict(message={'content': "@**test** test message"},
|
event=dict(message={'content': "@**test** test message"},
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
[program:zulip-bot-server]
|
[program:zulip-bot-server]
|
||||||
command=zulip-bot-server --config-file=<path/to/your/flaskbotrc> --hostname <address> --port <port>
|
command=zulip-bot-server --config-file=<path/to/your/botserverrc> --hostname <address> --port <port>
|
||||||
startsecs=3
|
startsecs=3
|
||||||
stdout_logfile=/var/log/zulip_botserver.log ; all output of your botserver will be logged here
|
stdout_logfile=/var/log/zulip_botserver.log ; all output of your botserver will be logged here
|
||||||
redirect_stderr=true
|
redirect_stderr=true
|
||||||
|
|
|
@ -3,14 +3,14 @@ import argparse
|
||||||
|
|
||||||
def parse_args() -> argparse.Namespace:
|
def parse_args() -> argparse.Namespace:
|
||||||
usage = '''
|
usage = '''
|
||||||
zulip-bot-server --config-file <path to flaskbotrc> --hostname <address> --port <port>
|
zulip-bot-server --config-file <path to botserverrc> --hostname <address> --port <port>
|
||||||
Example1: zulip-bot-server --config-file ~/flaskbotrc
|
Example1: zulip-bot-server --config-file ~/botserverrc
|
||||||
Example2: zulip-bot-server --config-file ~/flaskbotrc -b mybotname
|
Example2: zulip-bot-server --config-file ~/botserverrc -b mybotname
|
||||||
(This program loads the bot configurations from the
|
(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
|
It then starts the server and fetches the requests to the
|
||||||
above loaded modules and returns the success/failure result)
|
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.
|
configurations of the required bots.
|
||||||
Hostname and Port are optional arguments. Default hostname is
|
Hostname and Port are optional arguments. Default hostname is
|
||||||
127.0.0.1 and default port is 5002.
|
127.0.0.1 and default port is 5002.
|
||||||
|
@ -22,7 +22,7 @@ def parse_args() -> argparse.Namespace:
|
||||||
'--config-file',
|
'--config-file',
|
||||||
action='store',
|
action='store',
|
||||||
required=True,
|
required=True,
|
||||||
help='Config file for the zulip bot server (flaskbotrc)'
|
help='Config file for the zulip bot server (botserverrc)'
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--bot-config-file',
|
'--bot-config-file',
|
||||||
|
|
|
@ -56,7 +56,7 @@ def load_lib_modules(available_bots: List[str]) -> Dict[str, Any]:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
raise ImportError(
|
raise ImportError(
|
||||||
"\nImport Error: Bot \"{}\" doesn't exists. "
|
"\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
|
return bots_lib_module
|
||||||
|
|
||||||
|
@ -110,7 +110,7 @@ def handle_bot() -> Union[str, BadRequest]:
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
return BadRequest("Cannot find a bot with email {} in the bot server "
|
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']))
|
"match the bot emails on the server?".format(event['bot_email']))
|
||||||
lib_module = app.config.get("BOTS_LIB_MODULES", {})[bot]
|
lib_module = app.config.get("BOTS_LIB_MODULES", {})[bot]
|
||||||
bot_handler = app.config.get("BOT_HANDLERS", {})[bot]
|
bot_handler = app.config.get("BOT_HANDLERS", {})[bot]
|
||||||
|
|
Loading…
Reference in a new issue