shellbot.commands.start module

class shellbot.commands.start.Start(engine=None, **kwargs)[source]

Bases: shellbot.commands.base.Command

Restarts the underlying state machine

This command restarts the current state machine. A typical use case is when a person interacts with the bot over a direct channel for the initial gathering of data. For this kind of situation, the person will type start each time she initiates a new sequence.

You can check examples/direct.py as a practical tutorial.

Note: this command has no effect on a running machine.

Example to load the command in the engine:

engine = Engine(commands=['shellbot.commands.start', ...])

By default the command is visible only from direct channels. You can change this by configuring an instance before it is given to the engine:

start = Start()
start.in_group = True

engine = Engine(commands=[start, ...])

Obviously, this command should not be loaded if your use case does not rely on state machines, or if your state machines never end.

execute(bot, arguments=None, **kwargs)[source]

Restarts the underlying state machine

Parameters:
  • bot (Shellbot) – The bot for this execution
  • arguments (str or None) – The arguments for this command

This function calls the restart() function of the underlying state machine. It also transmits text typed by the end user after the command verb, and any other parameters received from the shell, e.g., attachment, etc.

Note: this command has no effect on a running machine.

in_direct = True
in_group = False
on_init()[source]

Localize strings for this command