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.

removeCommands( array $names)

Removes a list of commands.

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 31
__construct( Api $telegram)

Instantiate Command Bus.

Parameters

Api $telegram

Exceptions

TelegramSDKException

at line 41
array getCommands()

Returns the list of commands.

Return Value

array

at line 53
CommandBus addCommands( array $commands)

Add a list of commands.

Parameters

array $commands

Return Value

CommandBus

at line 71
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 117
CommandBus removeCommand($name)

Remove a command from the list.

Parameters

$name

Return Value

CommandBus

at line 131
CommandBus removeCommands( array $names)

Removes a list of commands.

Parameters

array $names

Return Value

CommandBus

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

Handles Inbound Messages and Executes Appropriate Command.

Parameters

$message
Update $update

Return Value

Update

Exceptions

TelegramSDKException

at line 172
array parseCommand($text)

Parse a Command for a Match.

Parameters

$text

Return Value

array

Exceptions

InvalidArgumentException

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

Execute the command.

Parameters

$name
$arguments
$message

Return Value

mixed