1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types = 1); |
4
|
|
|
|
5
|
|
|
namespace unreal4u\TelegramAPI\Telegram\Types; |
6
|
|
|
|
7
|
|
|
use unreal4u\TelegramAPI\Abstracts\KeyboardMethods; |
8
|
|
|
use unreal4u\TelegramAPI\Abstracts\TelegramTypes; |
9
|
|
|
use unreal4u\TelegramAPI\Telegram\Types\Custom\KeyboardButtonArray; |
10
|
|
|
|
11
|
|
|
/** |
12
|
|
|
* This object represents a custom keyboard with reply options (see Introduction to bots for details and examples). |
13
|
|
|
* |
14
|
|
|
* Objects defined as-is july 2016 |
15
|
|
|
* |
16
|
|
|
* @see https://core.telegram.org/bots/api#replykeyboardmarkup |
17
|
|
|
* @see https://core.telegram.org/bots#keyboards |
18
|
|
|
*/ |
19
|
|
|
class ReplyKeyboardMarkup extends KeyboardMethods |
20
|
|
|
{ |
21
|
|
|
/** |
22
|
|
|
* Array of button rows, each represented by an Array of KeyboardButton objects |
23
|
|
|
* @var array |
24
|
|
|
*/ |
25
|
|
|
public $keyboard = []; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* Optional. Requests clients to resize the keyboard vertically for optimal fit (e.g., make the keyboard smaller if |
29
|
|
|
* there are just two rows of buttons). Defaults to false, in which case the custom keyboard is always of the same |
30
|
|
|
* height as the app's standard keyboard. |
31
|
|
|
* @var bool |
32
|
|
|
*/ |
33
|
|
|
public $resize_keyboard = false; |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* Optional. Requests clients to hide the keyboard as soon as it's been used. The keyboard will still be available, |
37
|
|
|
* but clients will automatically display the usual letter-keyboard in the chat – the user can press a special |
38
|
|
|
* button in the input field to see the custom keyboard again. Defaults to false. |
39
|
|
|
* @var bool |
40
|
|
|
*/ |
41
|
|
|
public $one_time_keyboard = false; |
42
|
|
|
|
43
|
|
|
public function mapSubObjects(string $key, array $data): TelegramTypes |
44
|
|
|
{ |
45
|
|
|
switch ($key) { |
46
|
|
|
case 'keyboard': |
47
|
|
|
return new KeyboardButtonArray($data, $this->logger); |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
return parent::mapSubObjects($key, $data); |
51
|
|
|
} |
52
|
|
|
} |
53
|
|
|
|