PHP Class Telegram\Bot\Commands\CommandBus

Afficher le fichier Open project: irazasyed/telegram-bot-sdk

Protected Properties

Свойство Type Description
$commandAliases Holds all commands' aliases.
$commands Holds all commands.

Méthodes publiques

Méthode Description
__construct ( Api $telegram ) Instantiate Command Bus.
addCommand ( Telegram\Bot\Commands\CommandInterface | string $command ) : CommandBus Add a command to the commands list.
addCommands ( array $commands ) : CommandBus Add a list of commands.
getCommands ( ) : array Returns the list of commands.
parseCommand ( $text ) : array Parse a Command for a Match.
removeCommand ( $name ) : CommandBus Remove a command from the list.
removeCommands ( array $names ) : CommandBus Removes a list of commands.

Méthodes protégées

Méthode Description
execute ( $name, $arguments, $message ) : mixed Execute the command.
handler ( $message, Update $update ) : Update Handles Inbound Messages and Executes Appropriate Command.

Method Details

__construct() public méthode

Instantiate Command Bus.
public __construct ( Api $telegram )
$telegram Telegram\Bot\Api

addCommand() public méthode

Add a command to the commands list.
public addCommand ( Telegram\Bot\Commands\CommandInterface | string $command ) : CommandBus
$command Telegram\Bot\Commands\CommandInterface | string Either an object or full path to the command class.
Résultat CommandBus

addCommands() public méthode

Add a list of commands.
public addCommands ( array $commands ) : CommandBus
$commands array
Résultat CommandBus

execute() protected méthode

Execute the command.
protected execute ( $name, $arguments, $message ) : mixed
$name
$arguments
$message
Résultat mixed

getCommands() public méthode

Returns the list of commands.
public getCommands ( ) : array
Résultat array

handler() protected méthode

Handles Inbound Messages and Executes Appropriate Command.
protected handler ( $message, Update $update ) : Update
$message
$update Telegram\Bot\Objects\Update
Résultat Telegram\Bot\Objects\Update

parseCommand() public méthode

Parse a Command for a Match.
public parseCommand ( $text ) : array
$text
Résultat array

removeCommand() public méthode

Remove a command from the list.
public removeCommand ( $name ) : CommandBus
$name
Résultat CommandBus

removeCommands() public méthode

Removes a list of commands.
public removeCommands ( array $names ) : CommandBus
$names array
Résultat CommandBus

Property Details

$commandAliases protected_oe property

Holds all commands' aliases.
protected $commandAliases

$commands protected_oe property

Holds all commands.
protected $commands