1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace TgBotApi\BotApiBase\Type\InlineQueryResult; |
6
|
|
|
|
7
|
|
|
use TgBotApi\BotApiBase\Method\Traits\FillFromArrayTrait; |
8
|
|
|
use TgBotApi\BotApiBase\Type\InputMessageContent\InputMessageContentType; |
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* Class InlineQueryResultLocationType. |
12
|
|
|
* |
13
|
|
|
* Represents a location on a map. By default, the location will be sent by the user. |
14
|
|
|
* Alternatively, you can use input_message_content to send a message |
15
|
|
|
* with the specified content instead of the location. |
16
|
|
|
* |
17
|
|
|
* @see https://core.telegram.org/bots/api#inlinequeryresultlocation |
18
|
|
|
*/ |
19
|
|
|
class InlineQueryResultLocationType extends InlineQueryResultType |
20
|
|
|
{ |
21
|
|
|
use FillFromArrayTrait; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* Location latitude in degrees. |
25
|
|
|
* |
26
|
|
|
* @var float |
27
|
|
|
*/ |
28
|
|
|
public $latitude; |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* Location longitude in degrees. |
32
|
|
|
* |
33
|
|
|
* @var float |
34
|
|
|
*/ |
35
|
|
|
public $longitude; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* Location title. |
39
|
|
|
* |
40
|
|
|
* @var string |
41
|
|
|
*/ |
42
|
|
|
public $title; |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* Optional. Period in seconds for which the location can be updated, should be between 60 and 86400. |
46
|
|
|
* |
47
|
|
|
* @var int|null |
48
|
|
|
*/ |
49
|
|
|
public $livePeriod; |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* Optional. Content of the message to be sent instead of the location. |
53
|
|
|
* |
54
|
|
|
* @var InputMessageContentType|null |
55
|
|
|
*/ |
56
|
|
|
public $inputMessageContent; |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* Optional. Url of the thumbnail for the result. |
60
|
|
|
* |
61
|
|
|
* @var string|null |
62
|
|
|
*/ |
63
|
|
|
public $thumbUrl; |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* Optional. Thumbnail width. |
67
|
|
|
* |
68
|
|
|
* @var int|null |
69
|
|
|
*/ |
70
|
|
|
public $thumbWidth; |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* Optional. Thumbnail height. |
74
|
|
|
* |
75
|
|
|
* @var int|null |
76
|
|
|
*/ |
77
|
|
|
public $thumbHeight; |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* @param string $id |
81
|
|
|
* @param float $latitude |
82
|
|
|
* @param float $longitude |
83
|
|
|
* @param string $title |
84
|
|
|
* @param array|null $data |
85
|
|
|
* |
86
|
|
|
* @throws \TgBotApi\BotApiBase\Exception\BadArgumentException |
87
|
|
|
* |
88
|
|
|
* @return InlineQueryResultLocationType |
89
|
|
|
*/ |
90
|
|
|
public static function create( |
91
|
|
|
string $id, |
92
|
|
|
float $latitude, |
93
|
|
|
float $longitude, |
94
|
|
|
string $title, |
95
|
|
|
array $data = null |
96
|
|
|
): InlineQueryResultLocationType { |
97
|
|
|
$instance = new static(); |
98
|
|
|
$instance->type = static::TYPE_LOCATION; |
99
|
|
|
$instance->id = $id; |
100
|
|
|
$instance->latitude = $latitude; |
101
|
|
|
$instance->longitude = $longitude; |
102
|
|
|
$instance->title = $title; |
103
|
|
|
if ($data) { |
104
|
|
|
$instance->fill($data); |
105
|
|
|
} |
106
|
|
|
|
107
|
|
|
return $instance; |
108
|
|
|
} |
109
|
|
|
} |
110
|
|
|
|