-
-
Notifications
You must be signed in to change notification settings - Fork 959
Expand file tree
/
Copy pathInlineQuery.php
More file actions
57 lines (52 loc) · 1.92 KB
/
Copy pathInlineQuery.php
File metadata and controls
57 lines (52 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php
/**
* This file is part of the TelegramBot package.
*
* (c) Avtandil Kikabidze aka LONGMAN <akalongman@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Longman\TelegramBot\Entities;
use Longman\TelegramBot\Entities\InlineQuery\InlineQueryResult;
use Longman\TelegramBot\Request;
/**
* Class InlineQuery
*
* @link https://core.telegram.org/bots/api#inlinequery
*
* @method string getId() Unique identifier for this query
* @method User getFrom() Sender
* @method Location getLocation() Optional. Sender location, only for bots that request user location
* @method string getQuery() Text of the query (up to 512 characters)
* @method string getOffset() Offset of the results to be returned, can be controlled by the bot
* @method string getChatType() Optional. Type of the chat, from which the inline query was sent. Can be either “sender” for a private chat with the inline query sender, “private”, “group”, “supergroup”, or “channel”. The chat type should be always known for requests sent from official clients and most third-party clients, unless the request was sent from a secret chat
*/
class InlineQuery extends Entity
{
/**
* {@inheritdoc}
*/
protected function subEntities(): array
{
return [
'from' => User::class,
'location' => Location::class,
];
}
/**
* Answer this inline query with the passed results.
*
* @param InlineQueryResult[] $results
* @param array $data
*
* @return ServerResponse
*/
public function answer(array $results, array $data = []): ServerResponse
{
return Request::answerInlineQuery(array_merge([
'inline_query_id' => $this->getId(),
'results' => $results,
], $data));
}
}