PhpBotFramework
2.0.2
A framework for Telegram Bots' APIs.
|
Modules | |
Users handling | |
Handle bot users on the database. | |
Functions | |
PhpBotFramework\Database\Database::__construct (BasicBot &$bot) | |
bool | PhpBotFramework\Database\Database::connect (array $params) |
Open a database connection using PDO. More... | |
static array | PhpBotFramework\Database\Database::addDefaultValue (array $params) |
static string | PhpBotFramework\Database\Database::getDns ($params) |
PhpBotFramework\Database\Database::sanitizeUserTable () | |
int | PhpBotFramework\Database\LongPolling::getUpdateOffsetRedis (string $offset_key) |
PhpBotFramework\Database\LongPolling::getUpdatesRedis (int $limit=100, int $timeout=60, string $offset_key='offset') | |
Get updates received by the bot, and use Redis to save and get the last offset. More... | |
int | PhpBotFramework\Database\LongPolling::getUpdateOffsetDatabase (string $table_name, string $column_name) |
PhpBotFramework\Database\LongPolling::getUpdatesDatabase (int $limit=100, int $timeout=0, string $table_name='telegram', string $column_name='bot_offset') | |
Get updates received by the bot, using the SQL database to store and get the last offset. More... | |
bool PhpBotFramework\Database\Database::connect | ( | array | $params | ) |
Open a database connection using PDO.
Provides a simple way to initialize a database connection and create a PDO instance.
array | $params | Parameters for initialize connection. Index required:
|
|
static |
Check if the current field matches one of the fields that are passed to PDO in another way and so don't need to be included in the string.
PhpBotFramework\Database\LongPolling::getUpdatesDatabase | ( | int | $limit = 100 , |
int | $timeout = 0 , |
||
string | $table_name = 'telegram' , |
||
string | $column_name = 'bot_offset' |
||
) |
Get updates received by the bot, using the SQL database to store and get the last offset.
It check if an offset exists on redis, then get it, or call getUpdates to set it. Then it start a loop where it process updates and update the offset on Redis. Each update is surrounded by a try/catch.
int | $limit | Optional. Limits the number of updates to be retrieved. Values between 1—100 are accepted. |
int | $timeout | Optional. Timeout (in seconds) for long polling. |
string | $table_name | Optional. Name of the table where offset is saved in the database. |
string | $column_name | Optional. Name of the column where the offset is saved in the database. |
PhpBotFramework\Database\LongPolling::getUpdatesRedis | ( | int | $limit = 100 , |
int | $timeout = 60 , |
||
string | $offset_key = 'offset' |
||
) |
Get updates received by the bot, and use Redis to save and get the last offset.
It check if an offset exists on Redis: then get it or call getUpdates to set it. Then it start a loop where it process updates and update the offset on Redis. Each update is surrounded by a try/catch.
int | $limit | Optional. Limits the number of updates to be retrieved. Values between 1—100 are accepted. |
int | $timeout | Optional. Timeout (in seconds) for long polling. |
string | $offset_key | Optional. Name of the variable where the offset is saved on Redis. |