![]() |
PhpBotFramework
2.0.2
A framework for Telegram Bots' APIs.
|
Handles and stores results before sending them to an answerInlineQuery API call. More...
Functions | |
| PhpBotFramework\Entities\InlineQueryResults::__construct () | |
| int | PhpBotFramework\Entities\InlineQueryResults::addResult (array $result) |
| Add a result passing an array containing data. More... | |
| int | PhpBotFramework\Entities\InlineQueryResults::newArticle (string $title, string $message_text, string $description='', array $reply_markup=null, $parse_mode='HTML', $disable_web_preview=false) |
| Add a result of type Article. More... | |
| string | PhpBotFramework\Entities\InlineQueryResults::get () |
| Get all results created. More... | |
Handles and stores results before sending them to an answerInlineQuery API call.
In order to answer inline queries: create an object of type PhpBotFramework and add the wanted results using InlineQueryResults::addResult() method or type-based result method (InlineQueryResults::newArticle()).
use PhpBotFramework\Entities\InlineQueryResults;
use PhpBotFramework\Entities\InlineQuery;
~
~
~
processInlineQuery(InlineQuery $inline_query) {
$handler = new InlineQueryResults();
$handler->newArticle('First article', 'This is the first result');
$this->answerInlineQuery($handler->get());
}| PhpBotFramework\Entities\InlineQueryResults::__construct | ( | ) |
Create an InlineQueryResult object.
| int PhpBotFramework\Entities\InlineQueryResults::addResult | ( | array | $result | ) |
Add a result passing an array containing data.
Create a result of one of these types:
To add a result, create an array containing data as showed on API Reference, 'id' parameter will be automatically genereted so there is no need to add it.
Example of adding an article result:
$data = [
'type' => 'result',
'title' => 'Example title',
'message_text' => 'Text of the message'
];
$handler->addResult($data);
| array | $result | Array containing data result to add. |
| string PhpBotFramework\Entities\InlineQueryResults::get | ( | ) |
Get all results created.
| int PhpBotFramework\Entities\InlineQueryResults::newArticle | ( | string | $title, |
| string | $message_text, | ||
| string | $description = '', |
||
| array | $reply_markup = null, |
||
$parse_mode = 'HTML', |
|||
$disable_web_preview = false |
|||
| ) |
Add a result of type Article.
Add a result that will be show to the user.
| string | $title | Title of the result. |
| string | $message_text | Text of the message to be sent. |
| string | $description | Optional. Short description of the result |
| array | $reply_markup | Inline keyboard object. Not JSON serialized, use getArray from InlineKeyboard class. |
| string | $parse_mode | Optional. Formattation style for the message. |
| string | $disable_web_preview | Optional. Disables link previews for links in the sent message. |
1.8.13