shipany.bot.cli
shipany.bot.cli package
Submodules
shipany.bot.cli.main module
Command-line interface of the bot.
Ensure that you have the required environment variables set before running the bot. Dotenv files are supported.
Commands:
-
run: Run the bot with a given conversation description.Expects
BOT_TOKENenvironment variables to be set. If not, it will raise an error.Terminal window shipany-bot-cli run path/to/conversation.jsonConversation description is a JSON file that describes the conversation flow. The bot will use this file to interact with the user. The JSON file should follow the schema provided by the bot. You can print the schema by running the following command:
Terminal window shipany-bot-cli schemaBy default, the bot will run with the aiogram backend and the web server enabled. The bot will use the BOT_TOKEN environment variable to authenticate with Telegram. If you want to use a webhook mode, you can set the
TELEGRAM_WEBHOOK_URLandTELEGRAM_WEBHOOK_SECRETenvironment variables.To disable the web server, use the
--no-webflag. Otherwise, the web server will run on the default port 8000. You can change the port by setting theWEB_SERVER_PORTenvironment variable. The server is defined in theshipany.bot.web.servermodule.Terminal window shipany-bot-cli run path/to/conversation.json &curl http://localhost:8000/fgSee
shipany.bot.config.ApplicationConfigfor more information on configuration.To exit the bot, press Ctrl+C.
- param source: Path or URL to the json file with the conversation description.
- type source: str
- param secret: Secret in form of key=value to pass to the bot.
- type secret: list[str], optional
- param web: Enable the web server. Defaults to True.
- type web: bool, optional
schema: Prints the JSON schema of the conversation description supported by the bot.Terminal window shipany-bot-cli schema --indent 2
- param indent: Non-negative number to pretty-print JSON with the given indent levale. Defaults to 2.
- type indent: int, optional
version: Prints the version of the bot.Terminal window shipany-bot-cli version
shipany.bot.cli.main.logger = <Logger shipany.bot.cli.main (INFO)>
Logger for the bot CLI.
shipany.bot.cli.main.app = <typer.main.Typer object>
Typer application for the bot CLI.
- Parameters:
- args (Any)
- kwargs (Any)
- Return type: Any
shipany.bot.cli.main.run(source=<typer.models.ArgumentInfo object>, secret=<typer.models.OptionInfo object>, web=<typer.models.OptionInfo object>)
Run the bot with a given conversation description.
- Parameters:
- source (str)
- secret (list *[*str ])
- web (bool)
- Return type: None
shipany.bot.cli.main.schema(indent=<typer.models.OptionInfo object>)
Print the JSON schema of the conversation description supported by the bot.
- Parameters: indent (int)
- Return type: None
shipany.bot.cli.main.version()
Print the version of the bot.
- Return type: None