PHP Class Longman\TelegramBot\Commands\Command

Datei anzeigen Open project: akalongman/php-telegram-bot Class Usage Examples

Protected Properties

Property Type Description
$config array Command config
$description string Description
$enabled boolean If this command is enabled
$message Longman\TelegramBot\Entities\Message Message object
$name string Name
$need_mysql boolean If this command needs mysql
$telegram Longman\TelegramBot\Telegram Telegram object
$update Longman\TelegramBot\Entities\Update Update object
$usage string Usage
$version string Version

Public Methods

Method Description
__construct ( Telegram $telegram, Update $update = null ) Constructor
execute ( ) : ServerResponse Execute command
executeNoDb ( ) : ServerResponse Execution if MySQL is required but not available
getConfig ( string | null $name = null ) : array | mixed | null Get command config
getDescription ( ) : string Get description
getMessage ( ) : Message Get message object
getName ( ) : string Get name
getTelegram ( ) : Telegram Get telegram object
getUpdate ( ) : Update Get update object
getUsage ( ) : string Get usage
getVersion ( ) : string Get version
isAdminCommand ( ) : boolean If this is an AdminCommand
isEnabled ( ) : boolean Check if command is enabled
isSystemCommand ( ) : boolean If this is a SystemCommand
isUserCommand ( ) : boolean If this is a UserCommand
preExecute ( ) : ServerResponse Pre-execute command
setUpdate ( Update $update = null ) : Command Set update object

Method Details

__construct() public method

Constructor
public __construct ( Telegram $telegram, Update $update = null )
$telegram Longman\TelegramBot\Telegram
$update Longman\TelegramBot\Entities\Update

execute() abstract public method

Execute command
abstract public execute ( ) : ServerResponse
return Longman\TelegramBot\Entities\ServerResponse

executeNoDb() public method

Execution if MySQL is required but not available
public executeNoDb ( ) : ServerResponse
return Longman\TelegramBot\Entities\ServerResponse

getConfig() public method

Look for config $name if found return it, if not return null. If $name is not set return all set config.
public getConfig ( string | null $name = null ) : array | mixed | null
$name string | null
return array | mixed | null

getDescription() public method

Get description
public getDescription ( ) : string
return string

getMessage() public method

Get message object
public getMessage ( ) : Message
return Longman\TelegramBot\Entities\Message

getName() public method

Get name
public getName ( ) : string
return string

getTelegram() public method

Get telegram object
public getTelegram ( ) : Telegram
return Longman\TelegramBot\Telegram

getUpdate() public method

Get update object
public getUpdate ( ) : Update
return Longman\TelegramBot\Entities\Update

getUsage() public method

Get usage
public getUsage ( ) : string
return string

getVersion() public method

Get version
public getVersion ( ) : string
return string

isAdminCommand() public method

If this is an AdminCommand
public isAdminCommand ( ) : boolean
return boolean

isEnabled() public method

Check if command is enabled
public isEnabled ( ) : boolean
return boolean

isSystemCommand() public method

If this is a SystemCommand
public isSystemCommand ( ) : boolean
return boolean

isUserCommand() public method

If this is a UserCommand
public isUserCommand ( ) : boolean
return boolean

preExecute() public method

Pre-execute command
public preExecute ( ) : ServerResponse
return Longman\TelegramBot\Entities\ServerResponse

setUpdate() public method

Set update object
public setUpdate ( Update $update = null ) : Command
$update Longman\TelegramBot\Entities\Update
return Command

Property Details

$config protected_oe property

Command config
protected array $config
return array

$description protected_oe property

Description
protected string $description
return string

$enabled protected_oe property

If this command is enabled
protected bool $enabled
return boolean

$message protected_oe property

Message object
protected Message,Longman\TelegramBot\Entities $message
return Longman\TelegramBot\Entities\Message

$name protected_oe property

Name
protected string $name
return string

$need_mysql protected_oe property

If this command needs mysql
protected bool $need_mysql
return boolean

$telegram protected_oe property

Telegram object
protected Telegram,Longman\TelegramBot $telegram
return Longman\TelegramBot\Telegram

$update protected_oe property

Update object
protected Update,Longman\TelegramBot\Entities $update
return Longman\TelegramBot\Entities\Update

$usage protected_oe property

Usage
protected string $usage
return string

$version protected_oe property

Version
protected string $version
return string