![]() |
PhpBotFramework
2.0.2
A framework for Telegram Bots' APIs.
|
Bot class to handle updates and commands. More...
Public Member Functions | |
__construct (string $token) | |
Construct an empty bot. More... | |
![]() | |
__construct (string $token) | |
Construct an empty base bot. More... | |
processWebhookUpdate () | |
Get update and process it. More... | |
getUpdatesLocal (int $limit=100, int $timeout=60) | |
Get updates received by the bot, and hold the offset in $offset. More... | |
![]() | |
__construct (string $token) | |
int | getChatID () |
Get chat ID of the current user. More... | |
setChatID ($chat_id) | |
Set current chat ID. More... | |
int | getBotID () |
Get bot ID using getMe method. More... | |
mixed | apiRequest (string $method, array $parameters) |
Execute any API request using this method. More... | |
checkRequestError ($response) | |
![]() | |
setWebhook (array $params) | |
Set bot's webhook. More... | |
Array false | getWebhookInfo () |
Get information about bot's webhook. More... | |
deleteWebhook () | |
Delete bot's webhook. More... | |
Array false | getUpdates (int $offset=0, int $limit=100, int $timeout=60) |
Request bot updates. More... | |
setUpdateReturned (array $allowed_updates=[]) | |
Set updates received by the bot for getUpdates handling. More... | |
![]() | |
Message false | sendMessage ($text, string $reply_markup=null, int $reply_to=null, string $parse_mode='HTML', bool $disable_web_preview=true, bool $disable_notification=false) |
Send a text message. More... | |
Message false | forwardMessage ($from_chat_id, int $message_id, bool $disable_notification=false) |
Forward a message. More... | |
Message false | sendPhoto (&$photo, string $reply_markup=null, string $caption='', bool $disable_notification=false) |
Send a photo. More... | |
Message false | sendAudio ($audio, string $caption=null, string $reply_markup=null, int $duration=null, string $performer, string $title=null, bool $disable_notification=false, int $reply_to_message_id=null) |
Send an audio. More... | |
Message false | sendDocument (string $document, string $caption='', string $reply_markup=null, bool $disable_notification=false, int $reply_to_message_id=null) |
Send a document. More... | |
Message false | sendSticker ($sticker, string $reply_markup=null, bool $disable_notification=false, int $reply_to_message_id=null) |
Send a sticker. More... | |
Message false | sendVoice ($voice, string $caption, int $duration, string $reply_markup=null, bool $disable_notification, int $reply_to_message_id=0) |
Send audio files. More... | |
bool | sendChatAction (string $action) |
Say the user what action bot's going to do. More... | |
![]() | |
Message false | editMessageText (int $message_id, string $text, string $reply_markup=null, string $parse_mode='HTML', bool $disable_web_preview=true) |
Edit text of a message sent by the bot. More... | |
bool | editInlineMessageText (string $inline_message_id, string $text, string $reply_markup=null, string $parse_mode='HTML', bool $disable_web_preview=false) |
Edit text of a message sent via the bot. More... | |
Message false | editMessageReplyMarkup (int $message_id, string $inline_keyboard) |
Edit only the inline keyboard of a message. More... | |
![]() | |
bool | answerCallbackQuery ($text='', $show_alert=false, string $url='') |
Answer a callback query. More... | |
bool | answerInlineQuery (string $results='', string $switch_pm_text='', $switch_pm_parameter='', bool $is_personal=true, int $cache_time=300) |
Answer a inline query (when the user write "Query") with a button, that will make user switch to the private chat with the bot, on the top of the results. Api reference More... | |
![]() | |
Array false | getMe () |
A simple method for testing bot's auth token. More... | |
Array false | getChat ($chat_id) |
Get info about a chat. More... | |
Array false | getChatAdministrators ($chat_id) |
Use this method to get the list of chat's administrators. More... | |
![]() | |
addCommand (BasicCommand $command) | |
Add a command to the bot. More... | |
![]() | |
PDO | getPdo () |
Get PDO object. More... | |
Redis | getRedis () |
Get Redis object. More... | |
![]() | |
getUpdates (int $offset=0, int $limit=100, int $timeout=60) | |
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... | |
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... | |
Public Attributes | |
$keyboard | |
Store the inline keyboard. | |
$database | |
Database handler object. | |
$redis | |
Redis connection. | |
$local | |
Localization handler object. | |
$status | |
Status handler object. | |
![]() | |
$_http | |
![]() | |
$database | |
$redis | |
Additional Inherited Members | |
![]() | |
static int | sortingPrior ($a, $b) |
![]() | |
int | processUpdate (array $update) |
processMessage (Message $message) | |
Called every message received by the bot. More... | |
processCallbackQuery (CallbackQuery $callback_query) | |
Called every callback query received by the bot. More... | |
processInlineQuery (InlineQuery $inline_query) | |
Called every inline query received by the bot. More... | |
processChosenInlineResult (ChosenInlineResult $chosen_inline_result) | |
Called every chosen inline result received by the bot. More... | |
processEditedMessage (Message $edited_message) | |
Called every chosen edited message received by the bot. More... | |
processChannelPost (Message $post) | |
Called every new post in the channel where the bot is in. More... | |
processEditedChannelPost (Message $edited_post) | |
Called every time a post get edited in the channel where the bot is in. More... | |
![]() | |
mixed | processRequest (string $method, string $class='', $file=false) |
PhpBotFramework Entities File false | checkCurrentFile () |
Array false | execRequest (string $url) |
Array false | execMultipartRequest (string $url) |
![]() | |
execRequest (string $url) | |
![]() | |
execRequest (string $url) | |
processRequest (string $method, string $class, $file) | |
checkCurrentFile (TelegramFile $file) | |
![]() | |
execRequest (string $url) | |
![]() | |
execRequest (string $url) | |
![]() | |
execRequest (string $url) | |
![]() | |
initCommands () | |
bool | processCommands (array $update) |
![]() | |
initCommands () | |
int | getUpdateOffsetRedis (string $offset_key) |
int | getUpdateOffsetDatabase (string $table_name, string $column_name) |
![]() | |
$_is_webhook | |
![]() | |
$_chat_id | |
$_bot_id | |
$_api_url | |
$_file | |
$parameters | |
![]() | |
$parameters | |
![]() | |
$parameters | |
![]() | |
$_callback_query_id | |
$_inline_query_id | |
Bot class to handle updates and commands.
Class Bot to handle task like API request, or more specific API method like sendMessage, editMessageText, etc.. An example of its usage is available in webhook.php
that contains all modules.