1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace TelegramBot\Api\Types; |
4
|
|
|
|
5
|
|
|
use TelegramBot\Api\BaseType; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* Class ReplyKeyboardMarkup |
9
|
|
|
* This object represents a custom keyboard with reply options (see Introduction to bots for details and examples). |
10
|
|
|
* |
11
|
|
|
* @package TelegramBot\Api\Types |
12
|
|
|
*/ |
13
|
|
|
class ReplyKeyboardMarkup extends BaseType |
14
|
|
|
{ |
15
|
|
|
/** |
16
|
|
|
* {@inheritdoc} |
17
|
|
|
* |
18
|
|
|
* @var array |
19
|
|
|
*/ |
20
|
|
|
protected static $requiredParams = ['keyboard']; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* {@inheritdoc} |
24
|
|
|
* |
25
|
|
|
* @var array |
26
|
|
|
*/ |
27
|
|
|
protected static $map = [ |
28
|
|
|
'keyboard' => true, |
29
|
|
|
'one_time_keyboard' => true, |
30
|
|
|
'resize_keyboard' => true, |
31
|
|
|
'selective' => true, |
32
|
|
|
'is_persistent' => true, |
33
|
|
|
'input_field_placeholder' => true, |
34
|
|
|
]; |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* Array of button rows, each represented by an Array of Strings |
38
|
|
|
* Array of Array of String |
39
|
|
|
* |
40
|
|
|
* @var array |
41
|
|
|
*/ |
42
|
|
|
protected $keyboard; |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* Optional. Requests clients to resize the keyboard vertically for optimal fit |
46
|
|
|
* (e.g., make the keyboard smaller if there are just two rows of buttons). |
47
|
|
|
* Defaults to false, in which case the custom keyboard is always of the same height as the app's standard keyboard. |
48
|
|
|
* |
49
|
|
|
* @var bool|null |
50
|
|
|
*/ |
51
|
|
|
protected $resizeKeyboard; |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* Optional. Requests clients to hide the keyboard as soon as it's been used. Defaults to false. |
55
|
|
|
* |
56
|
|
|
* @var bool|null |
57
|
|
|
*/ |
58
|
|
|
protected $oneTimeKeyboard; |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* Optional. Use this parameter if you want to show the keyboard to specific users only. |
62
|
|
|
* Targets: |
63
|
|
|
* 1) users that are @mentioned in the text of the Message object; |
64
|
|
|
* 2) if the bot's message is a reply (has reply_to_message_id), sender of the original message. |
65
|
|
|
* |
66
|
|
|
* @var bool|null |
67
|
|
|
*/ |
68
|
16 |
|
protected $selective; |
69
|
|
|
|
70
|
16 |
|
/** |
71
|
16 |
|
* Optional. Requests clients to always show the keyboard when the regular keyboard is hidden. |
72
|
16 |
|
* Defaults to false, in which case the custom keyboard can be hidden and opened with a keyboard icon. |
73
|
16 |
|
* |
74
|
16 |
|
* @var bool|null |
75
|
|
|
*/ |
76
|
|
|
protected $isPersistent; |
77
|
|
|
|
78
|
|
|
/** |
79
|
1 |
|
* Optional. The placeholder to be shown in the input field when the keyboard is active; 1-64 characters |
80
|
|
|
* |
81
|
1 |
|
* @var string|null |
82
|
|
|
*/ |
83
|
|
|
protected $inputFieldPlaceholder; |
84
|
|
|
|
85
|
|
|
/** |
86
|
|
|
* @param array $keyboard |
87
|
2 |
|
* @param bool|null $oneTimeKeyboard |
88
|
|
|
* @param bool|null $resizeKeyboard |
89
|
2 |
|
* @param bool|null $selective |
90
|
2 |
|
* @param bool|null $isPersistent |
91
|
|
|
* @param string|null $inputFieldPlaceholder |
92
|
|
|
*/ |
93
|
|
|
public function __construct($keyboard = [], $oneTimeKeyboard = null, $resizeKeyboard = null, $selective = null, $isPersistent = null, $inputFieldPlaceholder = null) |
94
|
|
|
{ |
95
|
1 |
|
$this->keyboard = $keyboard; |
96
|
|
|
$this->oneTimeKeyboard = $oneTimeKeyboard; |
97
|
1 |
|
$this->resizeKeyboard = $resizeKeyboard; |
98
|
|
|
$this->selective = $selective; |
99
|
|
|
$this->isPersistent = $isPersistent; |
100
|
|
|
$this->inputFieldPlaceholder = $inputFieldPlaceholder; |
101
|
|
|
} |
102
|
|
|
|
103
|
2 |
|
/** |
104
|
|
|
* @return array |
105
|
2 |
|
*/ |
106
|
2 |
|
public function getKeyboard() |
107
|
|
|
{ |
108
|
|
|
return $this->keyboard; |
109
|
|
|
} |
110
|
|
|
|
111
|
1 |
|
/** |
112
|
|
|
* @param array $keyboard |
113
|
1 |
|
* @return void |
114
|
|
|
*/ |
115
|
|
|
public function setKeyboard($keyboard) |
116
|
|
|
{ |
117
|
|
|
$this->keyboard = $keyboard; |
118
|
|
|
} |
119
|
2 |
|
|
120
|
|
|
/** |
121
|
2 |
|
* @return bool|null |
122
|
2 |
|
*/ |
123
|
|
|
public function isOneTimeKeyboard() |
124
|
|
|
{ |
125
|
|
|
return $this->oneTimeKeyboard; |
126
|
|
|
} |
127
|
1 |
|
|
128
|
|
|
/** |
129
|
1 |
|
* @param bool $oneTimeKeyboard |
130
|
|
|
* @return void |
131
|
|
|
*/ |
132
|
|
|
public function setOneTimeKeyboard($oneTimeKeyboard) |
133
|
|
|
{ |
134
|
|
|
$this->oneTimeKeyboard = $oneTimeKeyboard; |
135
|
2 |
|
} |
136
|
|
|
|
137
|
2 |
|
/** |
138
|
2 |
|
* @return bool|null |
139
|
|
|
*/ |
140
|
|
|
public function isResizeKeyboard() |
141
|
|
|
{ |
142
|
|
|
return $this->resizeKeyboard; |
143
|
|
|
} |
144
|
|
|
|
145
|
|
|
/** |
146
|
|
|
* @param bool $resizeKeyboard |
147
|
|
|
* @return void |
148
|
|
|
*/ |
149
|
|
|
public function setResizeKeyboard($resizeKeyboard) |
150
|
|
|
{ |
151
|
|
|
$this->resizeKeyboard = $resizeKeyboard; |
152
|
|
|
} |
153
|
|
|
|
154
|
|
|
/** |
155
|
|
|
* @return bool|null |
156
|
|
|
*/ |
157
|
|
|
public function isSelective() |
158
|
|
|
{ |
159
|
|
|
return $this->selective; |
160
|
|
|
} |
161
|
|
|
|
162
|
|
|
/** |
163
|
|
|
* @param bool $selective |
164
|
|
|
* @return void |
165
|
|
|
*/ |
166
|
|
|
public function setSelective($selective) |
167
|
|
|
{ |
168
|
|
|
$this->selective = $selective; |
169
|
|
|
} |
170
|
|
|
|
171
|
|
|
/** |
172
|
|
|
* @return bool|null |
173
|
|
|
*/ |
174
|
|
|
public function getIsPersistent() |
175
|
|
|
{ |
176
|
|
|
return $this->isPersistent; |
177
|
|
|
} |
178
|
|
|
|
179
|
|
|
/** |
180
|
|
|
* @param bool $isPersistent |
181
|
|
|
* @return void |
182
|
|
|
*/ |
183
|
|
|
public function setIsPersistent($isPersistent) |
184
|
|
|
{ |
185
|
|
|
$this->isPersistent = $isPersistent; |
186
|
|
|
} |
187
|
|
|
|
188
|
|
|
/** |
189
|
|
|
* @return string|null |
190
|
|
|
*/ |
191
|
|
|
public function getInputFieldPlaceholder() |
192
|
|
|
{ |
193
|
|
|
return $this->inputFieldPlaceholder; |
194
|
|
|
} |
195
|
|
|
|
196
|
|
|
/** |
197
|
|
|
* @param string|null $inputFieldPlaceholder |
198
|
|
|
* @return void |
199
|
|
|
*/ |
200
|
|
|
public function setInputFieldPlaceholder($inputFieldPlaceholder) |
201
|
|
|
{ |
202
|
|
|
$this->inputFieldPlaceholder = $inputFieldPlaceholder; |
203
|
|
|
} |
204
|
|
|
} |
205
|
|
|
|