blab_chatbot_bot_client.cli#

Contains methods used by the command-line interface.

Module Contents#

Classes#

BlabBotClientArgParser

Parses the arguments and settings and performs the specified actions.

Functions#

_is_interactive()

Detect if this is an interactive terminal session.

_is_interactive()#

Detect if this is an interactive terminal session.

Returns

True if the terminal session is iterative, False otherwise

Return type:

bool

class BlabBotClientArgParser(client)#

Parses the arguments and settings and performs the specified actions.

Create an instance of the parser.

Parameters:

client (type[BotClientConversation[Any]]) – the conversation instance on the client

classmethod _load_config(path)#

Load a configuration file. It must be a .py file.

Parameters:

path (str) – path to the configuration file

Return type:

BlabBotClientSettings

parse_and_run(arguments=None)#

Parse the command-line arguments and run the specified command.

Parameters:

arguments (list[str] | None) – the raw command-line arguments

Returns:

whether the execution was successful

Return type:

bool

run(arguments, settings)#

Execute the specified action.

Parameters:
  • arguments (argparse.Namespace) – the parsed command-line arguments

  • settings (BlabBotClientSettings) – the loaded configuration

Return type:

bool

get_user_message(nth)#

Read a message from the user.

If this is the first message, only read it if this bot is not expected to initiate the conversation.

Parameters:

nth (int) – the sequential number of the message in the conversation

Returns:

the message typed by the user, or an empty string if nothing should be read

Return type:

str

_start_console_chat(settings)#
Parameters:

settings (BlabBotClientSettings) –

Return type:

None

_display_prompt_on_terminal(sender_name)#
Parameters:

sender_name (str) –

Return type:

None

_display_message_on_terminal(message)#
Parameters:

message (Message | OutgoingMessage | str) –

Return type:

None