PHP Class Telegram\Bot\BotsManager

Mostra file Open project: irazasyed/telegram-bot-sdk

Protected Properties

Property Type Description
$bots Api[] The active bot instances.
$config array The config instance.
$container Illuminate\Contracts\Container\Container The container instance.

Public Methods

Method Description
__call ( string $method, array $parameters ) : mixed Magically pass methods to the default bot.
__construct ( array $config ) TelegramManager constructor.
bot ( string $name = null ) : Api Get a bot instance.
disconnect ( string $name = null ) : void Disconnect from the given bot.
getBotConfig ( string | null $name = null ) : array Get the configuration for a bot.
getBots ( ) : Api[] Return all of the created bots.
getConfig ( string $key, mixed $default = null ) : mixed Get the specified configuration value for Telegram.
getDefaultBot ( ) : string Get the default bot name.
reconnect ( string $name = null ) : Api Reconnect to the given bot.
setContainer ( Illuminate\Contracts\Container\Container $container ) Set the IoC Container.
setDefaultBot ( string $name ) Set the default bot name.

Protected Methods

Method Description
deduplicateArray ( array $array ) : array De-duplicate an array.
makeBot ( string $name ) : Api Make the bot instance.
parseBotCommands ( array $commands ) : array Builds the list of commands for the given commands array.
parseCommands ( array $commands ) : array Parse an array of commands and build a list.

Method Details

__call() public method

Magically pass methods to the default bot.
public __call ( string $method, array $parameters ) : mixed
$method string
$parameters array
return mixed

__construct() public method

TelegramManager constructor.
public __construct ( array $config )
$config array

bot() public method

Get a bot instance.
public bot ( string $name = null ) : Api
$name string
return Api

deduplicateArray() protected method

De-duplicate an array.
protected deduplicateArray ( array $array ) : array
$array array
return array

disconnect() public method

Disconnect from the given bot.
public disconnect ( string $name = null ) : void
$name string
return void

getBotConfig() public method

Get the configuration for a bot.
public getBotConfig ( string | null $name = null ) : array
$name string | null
return array

getBots() public method

Return all of the created bots.
public getBots ( ) : Api[]
return Api[]

getConfig() public method

Get the specified configuration value for Telegram.
public getConfig ( string $key, mixed $default = null ) : mixed
$key string
$default mixed
return mixed

getDefaultBot() public method

Get the default bot name.
public getDefaultBot ( ) : string
return string

makeBot() protected method

Make the bot instance.
protected makeBot ( string $name ) : Api
$name string
return Api

parseBotCommands() protected method

Builds the list of commands for the given commands array.
protected parseBotCommands ( array $commands ) : array
$commands array
return array An array of commands which includes global and bot specific commands.

parseCommands() protected method

Parse an array of commands and build a list.
protected parseCommands ( array $commands ) : array
$commands array
return array

reconnect() public method

Reconnect to the given bot.
public reconnect ( string $name = null ) : Api
$name string
return Api

setContainer() public method

Set the IoC Container.
public setContainer ( Illuminate\Contracts\Container\Container $container )
$container Illuminate\Contracts\Container\Container Container instance

setDefaultBot() public method

Set the default bot name.
public setDefaultBot ( string $name )
$name string

Property Details

$bots protected_oe property

The active bot instances.
protected Api[],Telegram\Bot $bots
return Api[]

$config protected_oe property

The config instance.
protected array $config
return array

$container protected_oe property

The container instance.
protected Container,Illuminate\Contracts\Container $container
return Illuminate\Contracts\Container\Container