PhpBotFramework  2.0.2
A framework for Telegram Bots' APIs.
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
PhpBotFramework\BasicBot Class Reference
Inheritance diagram for PhpBotFramework\BasicBot:
PhpBotFramework\Core\CoreBot PhpBotFramework\Commands\CommandHandler PhpBotFramework\Core\Updates PhpBotFramework\Core\Send PhpBotFramework\Core\Edit PhpBotFramework\Core\Inline PhpBotFramework\Core\Chat PhpBotFramework\Bot PhpBotFramework\Test\TestBot

Public Member Functions

 __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...
 
- Public Member Functions inherited from PhpBotFramework\Core\CoreBot
 __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)
 
- Public Member Functions inherited from PhpBotFramework\Core\Updates
 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...
 
- Public Member Functions inherited from PhpBotFramework\Core\Send
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...
 
- Public Member Functions inherited from PhpBotFramework\Core\Edit
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...
 
- Public Member Functions inherited from PhpBotFramework\Core\Inline
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...
 
- Public Member Functions inherited from PhpBotFramework\Core\Chat
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...
 
- Public Member Functions inherited from PhpBotFramework\Commands\CommandHandler
 addCommand (BasicCommand $command)
 Add a command to the bot. More...
 

Protected Member Functions

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...
 
- Protected Member Functions inherited from PhpBotFramework\Core\CoreBot
mixed processRequest (string $method, string $class='', $file=false)
 
PhpBotFramework Entities File false checkCurrentFile ()
 
Array false execRequest (string $url)
 
Array false execMultipartRequest (string $url)
 
- Protected Member Functions inherited from PhpBotFramework\Core\Updates
 execRequest (string $url)
 
- Protected Member Functions inherited from PhpBotFramework\Core\Send
 execRequest (string $url)
 
 processRequest (string $method, string $class, $file)
 
 checkCurrentFile (TelegramFile $file)
 
- Protected Member Functions inherited from PhpBotFramework\Core\Edit
 execRequest (string $url)
 
- Protected Member Functions inherited from PhpBotFramework\Core\Inline
 execRequest (string $url)
 
- Protected Member Functions inherited from PhpBotFramework\Core\Chat
 execRequest (string $url)
 
- Protected Member Functions inherited from PhpBotFramework\Commands\CommandHandler
 initCommands ()
 
bool processCommands (array $update)
 

Protected Attributes

 $_is_webhook
 
- Protected Attributes inherited from PhpBotFramework\Core\CoreBot
 $_chat_id
 
 $_bot_id
 
 $_api_url
 
 $_file
 
 $parameters
 
- Protected Attributes inherited from PhpBotFramework\Core\Send
 $parameters
 
- Protected Attributes inherited from PhpBotFramework\Core\Edit
 $parameters
 
- Protected Attributes inherited from PhpBotFramework\Core\Inline
 $_callback_query_id
 
 $_inline_query_id
 

Additional Inherited Members

- Static Public Member Functions inherited from PhpBotFramework\Commands\CommandHandler
static int sortingPrior ($a, $b)
 
- Public Attributes inherited from PhpBotFramework\Core\CoreBot
 $_http
 

Constructor & Destructor Documentation

◆ __construct()

PhpBotFramework\BasicBot::__construct ( string  $token)

Construct an empty base bot.

Construct a base bot that can handle updates.

Member Function Documentation

◆ processCallbackQuery()

PhpBotFramework\BasicBot::processCallbackQuery ( CallbackQuery  $callback_query)
protected

Called every callback query received by the bot.

Override it to script the bot answer for each callback. $chat_id and $data, if set in the callback query(use getCallbackData() to access it) set inside of this function.

Parameters
CallbackQuery$callback_queryReference to the callback query received.

◆ processChannelPost()

PhpBotFramework\BasicBot::processChannelPost ( Message  $post)
protected

Called every new post in the channel where the bot is in.

Override it to script the bot answer for each post sent in a channel. $chat_id set inside of this function.

Parameters
Message$postThe message sent in the channel.

◆ processChosenInlineResult()

PhpBotFramework\BasicBot::processChosenInlineResult ( ChosenInlineResult  $chosen_inline_result)
protected

Called every chosen inline result received by the bot.

Override it to script the bot answer for each chosen inline result. $chat_id set inside of this function.

Parameters
ChosenInlineResult$chosen_inline_resultReference to the chosen inline result received.

◆ processEditedChannelPost()

PhpBotFramework\BasicBot::processEditedChannelPost ( Message  $edited_post)
protected

Called every time a post get edited in the channel where the bot is in.

Override it to script the bot answer for each post edited in a channel. $chat_id set inside of this function.

Parameters
Message$postThe message edited in the channel.

◆ processEditedMessage()

PhpBotFramework\BasicBot::processEditedMessage ( Message  $edited_message)
protected

Called every chosen edited message received by the bot.

Override it to script the bot answer for each edited message. $chat_id set inside of this function.

Parameters
Message$edited_messageThe message edited by the user.

◆ processInlineQuery()

PhpBotFramework\BasicBot::processInlineQuery ( InlineQuery  $inline_query)
protected

Called every inline query received by the bot.

Override it to script the bot answer for each inline query. $chat_id and $query(use getInlineQuery() to access it) set inside of this function.

Parameters
InlineQuery$inline_queryReference to the inline query received.

◆ processMessage()

PhpBotFramework\BasicBot::processMessage ( Message  $message)
protected

Called every message received by the bot.

Override it to script the bot answer for each message. $chat_id and $text, if the message contains text(use getMessageText() to access it), set inside of this function.

Parameters
Message$messageReference to the message received.

The documentation for this class was generated from the following file: