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. The radius of uncertainty for the location, measured in meters; 0-1500. |
46
|
|
|
* |
47
|
|
|
* @var float|int|null |
48
|
|
|
*/ |
49
|
|
|
public $horizontalAccuracy; |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* Optional. Period in seconds for which the location can be updated, should be between 60 and 86400. |
53
|
|
|
* |
54
|
|
|
* @var int|null |
55
|
|
|
*/ |
56
|
|
|
public $livePeriod; |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* Optional. For live locations, a direction in which the user is moving, in degrees. |
60
|
|
|
* Must be between 1 and 360 if specified. |
61
|
|
|
* |
62
|
|
|
* @var int|null |
63
|
|
|
*/ |
64
|
|
|
public $heading; |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* Optional. For live locations, a maximum distance for proximity alerts a |
68
|
|
|
* bout approaching another chat member, in meters. Must be between 1 and 100000 if specified. |
69
|
|
|
* |
70
|
|
|
* @var int|null |
71
|
|
|
*/ |
72
|
|
|
public $proximityAlertRadius; |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* Optional. Content of the message to be sent instead of the location. |
76
|
|
|
* |
77
|
|
|
* @var InputMessageContentType|null |
78
|
|
|
*/ |
79
|
|
|
public $inputMessageContent; |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* Optional. Url of the thumbnail for the result. |
83
|
|
|
* |
84
|
|
|
* @var string|null |
85
|
|
|
*/ |
86
|
|
|
public $thumbUrl; |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* Optional. Thumbnail width. |
90
|
|
|
* |
91
|
|
|
* @var int|null |
92
|
|
|
*/ |
93
|
|
|
public $thumbWidth; |
94
|
|
|
|
95
|
|
|
/** |
96
|
|
|
* Optional. Thumbnail height. |
97
|
|
|
* |
98
|
|
|
* @var int|null |
99
|
|
|
*/ |
100
|
|
|
public $thumbHeight; |
101
|
|
|
|
102
|
|
|
/** |
103
|
|
|
* @throws \TgBotApi\BotApiBase\Exception\BadArgumentException |
104
|
|
|
*/ |
105
|
|
|
public static function create( |
106
|
|
|
string $id, |
107
|
|
|
float $latitude, |
108
|
|
|
float $longitude, |
109
|
|
|
string $title, |
110
|
|
|
array $data = null |
111
|
|
|
): InlineQueryResultLocationType { |
112
|
|
|
$instance = new static(); |
113
|
|
|
$instance->type = static::TYPE_LOCATION; |
114
|
|
|
$instance->id = $id; |
115
|
|
|
$instance->latitude = $latitude; |
116
|
|
|
$instance->longitude = $longitude; |
117
|
|
|
$instance->title = $title; |
118
|
|
|
if ($data) { |
119
|
|
|
$instance->fill($data); |
120
|
|
|
} |
121
|
|
|
|
122
|
|
|
return $instance; |
123
|
|
|
} |
124
|
|
|
} |
125
|
|
|
|