class CommandBus (View source)

Class CommandBus

Methods

__construct( Api $telegram)

Instantiate Command Bus

array
getCommands()

Returns the list of commands.

addCommands( array $commands)

Add a list of commands.

addCommand( CommandInterface|string $command)

Add a command to the commands list.

removeCommand($name)

Remove a command from the list.

handler($message, Update $update)

Handles Inbound Messages and Executes Appropriate Command.

array
parseCommand($text)

Parse a Command for a Match.

mixed
execute($name, $arguments, $message)

Execute the command.

Details

at line 33
__construct( Api $telegram)

Instantiate Command Bus

Parameters

Api $telegram

Exceptions

TelegramSDKException

at line 43
array getCommands()

Returns the list of commands.

Return Value

array

at line 55
CommandBus addCommands( array $commands)

Add a list of commands.

Parameters

array $commands

Return Value

CommandBus

at line 73
CommandBus addCommand( CommandInterface|string $command)

Add a command to the commands list.

Parameters

CommandInterface|string $command Either an object or full path to the command class.

Return Value

CommandBus

Exceptions

TelegramSDKException

at line 99
removeCommand($name)

Remove a command from the list.

Parameters

$name

at line 114
Update handler($message, Update $update)

Handles Inbound Messages and Executes Appropriate Command.

Parameters

$message
Update $update

Return Value

Update

Exceptions

TelegramSDKException

at line 137
array parseCommand($text)

Parse a Command for a Match.

Parameters

$text

Return Value

array

Exceptions

InvalidArgumentException

at line 157
mixed execute($name, $arguments, $message)

Execute the command.

Parameters

$name
$arguments
$message

Return Value

mixed