PHP Class Telegram\Bot\Commands\Command

Inheritance: implements Telegram\Bot\Commands\CommandInterface, use trait Telegram\Bot\Answers\Answerable
Mostra file Open project: irazasyed/telegram-bot-sdk Class Usage Examples

Protected Properties

Property Type Description
$aliases array Command Aliases Helpful when you want to trigger command with more than one name.
$arguments Arguments passed to the command.
$description The Telegram command description.
$name string Ex: help - Whenever the user sends /help, this would be resolved.

Public Methods

Method Description
getAliases ( ) : array Get Command Aliases
getArguments ( ) : string Get Arguments passed to the command.
getCommandBus ( ) : CommandBus Returns an instance of Command Bus.
getDescription ( ) : string Get Command Description.
getName ( ) : string Get Command Name.
handle ( $arguments )
make ( Api $telegram, $arguments, Update $update )
setDescription ( $description ) : Command Set Command Description.
setName ( $name ) : Command Set Command Name.

Protected Methods

Method Description
triggerCommand ( $command, null $arguments = null ) : mixed Helper to Trigger other Commands.

Method Details

getAliases() public method

Get Command Aliases
public getAliases ( ) : array
return array

getArguments() public method

Get Arguments passed to the command.
public getArguments ( ) : string
return string

getCommandBus() public method

Returns an instance of Command Bus.
public getCommandBus ( ) : CommandBus
return CommandBus

getDescription() public method

Get Command Description.
public getDescription ( ) : string
return string

getName() public method

Get Command Name.
public getName ( ) : string
return string

handle() abstract public method

abstract public handle ( $arguments )

make() public method

public make ( Api $telegram, $arguments, Update $update )
$telegram Telegram\Bot\Api
$update Telegram\Bot\Objects\Update

setDescription() public method

Set Command Description.
public setDescription ( $description ) : Command
$description
return Command

setName() public method

Set Command Name.
public setName ( $name ) : Command
$name
return Command

triggerCommand() protected method

Helper to Trigger other Commands.
protected triggerCommand ( $command, null $arguments = null ) : mixed
$command
$arguments null
return mixed

Property Details

$aliases protected_oe property

Command Aliases Helpful when you want to trigger command with more than one name.
protected array $aliases
return array

$arguments protected_oe property

Arguments passed to the command.
protected $arguments

$description protected_oe property

The Telegram command description.
protected $description

$name protected_oe property

Ex: help - Whenever the user sends /help, this would be resolved.
protected string $name
return string