![]() |
PhpBotFramework
1.0.0
A framework for Telegram Bots' APIs.
|
Bot class to handle updates and commandes. More...
Public Member Functions | |
| __construct (string $token) | |
| Construct an empy bot. More... | |
| __destruct () | |
| Descruct the class. | |
| & | getText () |
| Get the text of the message (for updates of type "message"). More... | |
| & | getData () |
| Get the data received from the callback query (for updates of type "callback_query"). More... | |
| & | getQuery () |
| Get the query received from the inline query (for updates of type "inline_query"). More... | |
| processWebhookUpdate () | |
| Get update and process it. More... | |
| processUpdate (array &$update) | |
| Dispatch each update to the right method (processMessage, processCallbackQuery, etc). More... | |
| getUpdatesRedis (int $limit=100, int $timeout=60, string $offset_key='offset') | |
| Get updates received by the bot, using redis to save and get the last offset. More... | |
| getUpdatesLocal (int $limit=100, int $timeout=60) | |
| Get updates received by the bot, and hold the offset in $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... | |
| addMessageCommand (string $command, $script) | |
| Add a function that will be executed everytime a message contain the selected command. More... | |
| & | sendMessageKeyboard (&$text, &$inline_keyboard, $parse_mode='HTML', $disable_web_preview=true, $disable_notification=false) |
| Optimized version of sendMessage that takes reference of $text and reference of $inline_keyboard. More... | |
| & | editMessageTextKeyboard (&$text, &$inline_keyboard, &$message_id, $parse_mode='HTML', $disable_web_preview=false) |
| Optimized version of editMessageText that takes reference of $text and $inline_keyboard. More... | |
| & | answerInlineQueryRef (&$results, $switch_pm_text, $switch_pm_parameter='', $is_personal=true, $cache_time=300) |
| Optimized version of answerInlineQuery that takes reference of $results. More... | |
| & | getLanguageDatabase ($default_language='en') |
| Get current user language from the database, and set it in $language. More... | |
| & | getLanguageRedis ($default_language='en') |
| Get current user language from redis, and set it in language. More... | |
| & | getLanguageRedisAsCache ($default_language='en', $expiring_time='86400') |
| Get current user language from redis, as a cache, and set it in language. More... | |
| setLanguageRedisAsCache ($language, $expiring_time='86400') | |
| Set the current user language in both redis, sql database and $language. More... | |
| & | getStatus ($default_status=-1) |
| Get current user status from redis and set it in status variable. More... | |
| setStatus ($status) | |
| Set the status of the bot in both redis and $status. More... | |
Public Member Functions inherited from DanySpin97\PhpBotFramework\CoreBot | |
| __construct (string $token) | |
| Contrusct an empty bot. More... | |
| __destruct () | |
| Destroy the object. | |
| & | getChatID () |
| Get chat id of the current user. More... | |
| setChatID ($chat_id) | |
| Set current chat id. More... | |
| & | 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... | |
| & | forwardMessage ($from_chat_id, int $message_id, bool $disable_notification=false) |
| Forward a message. More... | |
| & | sendPhoto ($photo, string $reply_markup=null, string $caption='', bool $disable_notification=false) |
| Send a photo. More... | |
| & | sendAudio ($audio, string $caption=null, string $reply_markup=null, int $duration=null, string $title=null, bool $disable_notification=false, int $reply_to_message_id=null) |
| Send an audio. More... | |
| & | senddocument ($document, string $caption='', string $reply_markup=null, bool $disable_notification=false, int $reply_to_message_id=null) |
| Send a document. More... | |
| & | sendSticker ($sticker, string $reply_markup=null, bool $disable_notification=false, int $reply_to_message_id=null) |
| Send a sticker. More... | |
| & | sendChatAction (string $action) |
| Say the user what action is the bot doing. More... | |
| & | getChat ($chat_id) |
| Get info about a chat. More... | |
| & | answerCallbackQuery ($text='', $show_alert=false, string $url='') |
| & | editMessageText ($text, int $message_id, $reply_markup=null, string $parse_mode='HTML', bool $disable_web_preview=false) |
| Edit text of a message sent by the bot. More... | |
| & | editInlineMessageText ($text, string $inline_message_id, string $reply_markup=null, string $parse_mode='HTML', bool $disable_web_preview=false) |
| Edit text of a message sent via the bot. More... | |
| & | editMessageReplyMarkup ($message_id, $inline_keyboard) |
| & | answerInlineQuerySwitchPM ($results, $switch_pm_text, $switch_pm_parameter='', $is_personal=true, $cache_time=300) |
| & | answerEmptyInlineQuerySwitchPM ($switch_pm_text, $switch_pm_parameter='', $is_personal=true, $cache_time=300) |
| & | apiRequest (string $method, array $parameters) |
| Exec any api request using this method. More... | |
Public Attributes | |
| $language | |
| Store the language for a multi-language bot. | |
| $localization | |
| Store the array containing language. | |
| $user_table = '"User"' | |
| Table contaning bot users data in the sql database. | |
| $id_column = 'chat_id' | |
| Name of the column that represents the user id in the sql database. | |
| $status | |
| Status of the bot to handle data inserting and menu-like bot. | |
Public Attributes inherited from DanySpin97\PhpBotFramework\CoreBot | |
| $ch | |
| Curl connection for request. | |
Protected Member Functions | |
| processMessage (&$message) | |
| Called every message received by the bot. More... | |
| processCallbackQuery (&$callback_query) | |
| Called every callback query received by the bot. More... | |
| processInlineQuery (&$inline_query) | |
| Called every inline query received by the bot. More... | |
| processChosenInlineResult (&$chosen_inline_result) | |
| Called every chosen inline result received by the bot. More... | |
| processEditedMessage (&$edited_message) | |
| Called every chosen edited message received by the bot. More... | |
Protected Member Functions inherited from DanySpin97\PhpBotFramework\CoreBot | |
| & | getUpdates (int $offset=0, int $limit=100, int $timeout=60) |
| Request bot updates. More... | |
| & | exec_curl_request ($url) |
| Base core function to execute url request. More... | |
| $inline_keyboard | |
| Store the inline keyboard. | |
| $pdo | |
| Pdo reference. | |
| $redis | |
| Redis connection. | |
Additional Inherited Members | |
Protected Attributes inherited from DanySpin97\PhpBotFramework\CoreBot | |
| $chat_id | |
| Chat_id of the user that interacted with the bot. | |
| $api_url | |
| Url request (containing $token). | |
Bot class to handle updates and commandes.
Class Bot to handle task like api request, or more specific api function(sendMessage, editMessageText, etc). Usage example in webhook.php
1.8.12