shellbot.commands.step module

class shellbot.commands.step.Step(engine=None, **kwargs)[source]

Bases: shellbot.commands.base.Command

Moves underlying state machine to the next step

This command sends an event to the current state machine. This can be handled by the state machine, e.g., a Steps instance, for moving forward.

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

Example to load the command in the engine:

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

By default, the command sends the event next to the state machine. This can be changed while creating your own command instance, before it is given to the engine. For example:

step = Steps(event='super_event')
engine = Engine(commands=[step, ...])

Obviously, this command should not be loaded if your use case does not rely on state machines, or if your state machines do not expect events from human beings.

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

Moves underlying state machine to the next step

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

This function calls the step() function of the underlying state machine and provides a static event. 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.

on_init()[source]

Localize strings for this command