PhpBotFramework  2.0.2
A framework for Telegram Bots' APIs.
Functions | Variables
Bot

Properties and methods to handle your Telegrams bot. More...

Functions

 PhpBotFramework\BasicBot::processWebhookUpdate ()
 Get update and process it. More...
 
 PhpBotFramework\BasicBot::getUpdatesLocal (int $limit=100, int $timeout=60)
 Get updates received by the bot, and hold the offset in $offset. More...
 
 PhpBotFramework\Bot::__construct (string $token)
 Construct an empty bot. More...
 
int PhpBotFramework\Core\CoreBot::getChatID ()
 Get chat ID of the current user. More...
 
 PhpBotFramework\Core\CoreBot::setChatID ($chat_id)
 Set current chat ID. More...
 
int PhpBotFramework\Core\CoreBot::getBotID ()
 Get bot ID using getMe method. More...
 

Variables

 PhpBotFramework\Bot::$keyboard
 Store the inline keyboard.
 
 PhpBotFramework\Bot::$database
 Database handler object.
 
 PhpBotFramework\Bot::$redis
 Redis connection.
 
 PhpBotFramework\Bot::$local
 Localization handler object.
 
 PhpBotFramework\Bot::$status
 Status handler object.
 

Detailed Description

Properties and methods to handle your Telegrams bot.

Here're listed all the properties and methods that offers facilities for bot's basic features.

Function Documentation

◆ __construct()

PhpBotFramework\Bot::__construct ( string  $token)

Construct an empty bot.

Construct a complete Telegram bot which can use localization, database and more other.

Parameters
string$tokenBot token, you can request one through BotFather on Telegram.

◆ getBotID()

int PhpBotFramework\Core\CoreBot::getBotID ( )

Get bot ID using getMe method.

Returns
int Bot id, 0 on errors.

◆ getChatID()

int PhpBotFramework\Core\CoreBot::getChatID ( )

Get chat ID of the current user.

Returns
int Chat ID of the user.

◆ getUpdatesLocal()

PhpBotFramework\BasicBot::getUpdatesLocal ( int  $limit = 100,
int  $timeout = 60 
)

Get updates received by the bot, and hold the offset in $offset.

Get the update_id of the first update to parse, set it in $offset and then it start an infinite loop where it processes updates and keep $offset on the update_id of the last update received. Each processUpdate() method call is surrounded by a try/catch.

See also
getUpdates
Parameters
int$limitOptional. Limits the number of updates to be retrieved. Values between 1—100 are accepted.
int$timeoutOptional. Timeout in seconds for long polling.

◆ processWebhookUpdate()

PhpBotFramework\BasicBot::processWebhookUpdate ( )

Get update and process it.

Call this method if user is using webhook. It'll get bot's update from php::, check it and then process it using processUpdate.

◆ setChatID()

PhpBotFramework\Core\CoreBot::setChatID (   $chat_id)

Set current chat ID.

Change the chat ID on which the bot acts.

Parameters
$chat_idThe new chat ID to set.