|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Zanzara\Telegram\Type\Keyboard; |
|
6
|
|
|
|
|
7
|
|
|
use Zanzara\Telegram\Type\CallbackGame; |
|
8
|
|
|
use Zanzara\Telegram\Type\Miscellaneous\LoginUrl; |
|
9
|
|
|
|
|
10
|
|
|
/** |
|
11
|
|
|
* This object represents one button of an inline keyboard. You must use exactly one of the optional fields. |
|
12
|
|
|
* |
|
13
|
|
|
* More on https://core.telegram.org/bots/api#inlinekeyboardbutton |
|
14
|
|
|
*/ |
|
15
|
|
|
class InlineKeyboardButton |
|
16
|
|
|
{ |
|
17
|
|
|
|
|
18
|
|
|
/** |
|
19
|
|
|
* Label text on the button |
|
20
|
|
|
* |
|
21
|
|
|
* @var string |
|
22
|
|
|
*/ |
|
23
|
|
|
private $text; |
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* Optional. HTTP or tg:// url to be opened when button is pressed |
|
27
|
|
|
* |
|
28
|
|
|
* @var string|null |
|
29
|
|
|
*/ |
|
30
|
|
|
private $url; |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* Optional. An HTTP URL used to automatically authorize the user. Can be used as a replacement for the Telegram Login |
|
34
|
|
|
* Widget. |
|
35
|
|
|
* |
|
36
|
|
|
* @var LoginUrl|null |
|
37
|
|
|
*/ |
|
38
|
|
|
private $login_url; |
|
39
|
|
|
|
|
40
|
|
|
/** |
|
41
|
|
|
* Optional. Data to be sent in a callback query to the bot when button is pressed, 1-64 bytes |
|
42
|
|
|
* |
|
43
|
|
|
* @var string|null |
|
44
|
|
|
*/ |
|
45
|
|
|
private $callback_data; |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* Optional. If set, pressing the button will prompt the user to select one of their chats, open that chat and insert |
|
49
|
|
|
* the bot's username and the specified inline query in the input field. Can be empty, in which case just the bot's |
|
50
|
|
|
* username will be inserted.Note: This offers an easy way for users to start using your bot in inline mode when they |
|
51
|
|
|
* are currently in a private chat with it. Especially useful when combined with switch_pm... actions - in this case |
|
52
|
|
|
* the user will be automatically returned to the chat they switched from, skipping the chat selection screen. |
|
53
|
|
|
* |
|
54
|
|
|
* @var string|null |
|
55
|
|
|
*/ |
|
56
|
|
|
private $switch_inline_query; |
|
57
|
|
|
|
|
58
|
|
|
/** |
|
59
|
|
|
* Optional. If set, pressing the button will insert the bot's username and the specified inline query in the current |
|
60
|
|
|
* chat's input field. Can be empty, in which case only the bot's username will be inserted.This offers a quick way |
|
61
|
|
|
* for the user to open your bot in inline mode in the same chat - good for selecting something from multiple |
|
62
|
|
|
* options. |
|
63
|
|
|
* |
|
64
|
|
|
* @var string|null |
|
65
|
|
|
*/ |
|
66
|
|
|
private $switch_inline_query_current_chat; |
|
67
|
|
|
|
|
68
|
|
|
/** |
|
69
|
|
|
* Optional. Description of the game that will be launched when the user presses the button.NOTE: This type of button |
|
70
|
|
|
* must always be the first button in the first row. |
|
71
|
|
|
* |
|
72
|
|
|
* @var CallbackGame|null |
|
73
|
|
|
*/ |
|
74
|
|
|
private $callback_game; |
|
75
|
|
|
|
|
76
|
|
|
/** |
|
77
|
|
|
* Optional. Specify True, to send a Pay button.NOTE: This type of button must always be the first button in the first row. |
|
78
|
|
|
* |
|
79
|
|
|
* @var bool|null |
|
80
|
|
|
*/ |
|
81
|
|
|
private $pay; |
|
82
|
|
|
|
|
83
|
|
|
/** |
|
84
|
|
|
* @return string |
|
85
|
|
|
*/ |
|
86
|
|
|
public function getText(): string |
|
87
|
|
|
{ |
|
88
|
|
|
return $this->text; |
|
89
|
|
|
} |
|
90
|
|
|
|
|
91
|
|
|
/** |
|
92
|
|
|
* @param string $text |
|
93
|
|
|
*/ |
|
94
|
|
|
public function setText(string $text): void |
|
95
|
|
|
{ |
|
96
|
|
|
$this->text = $text; |
|
97
|
|
|
} |
|
98
|
|
|
|
|
99
|
|
|
/** |
|
100
|
|
|
* @return string|null |
|
101
|
|
|
*/ |
|
102
|
|
|
public function getUrl(): ?string |
|
103
|
|
|
{ |
|
104
|
|
|
return $this->url; |
|
105
|
|
|
} |
|
106
|
|
|
|
|
107
|
|
|
/** |
|
108
|
|
|
* @param string|null $url |
|
109
|
|
|
*/ |
|
110
|
|
|
public function setUrl(?string $url): void |
|
111
|
|
|
{ |
|
112
|
|
|
$this->url = $url; |
|
113
|
|
|
} |
|
114
|
|
|
|
|
115
|
|
|
/** |
|
116
|
|
|
* @return LoginUrl|null |
|
117
|
|
|
*/ |
|
118
|
|
|
public function getLoginUrl(): ?LoginUrl |
|
119
|
|
|
{ |
|
120
|
|
|
return $this->login_url; |
|
121
|
|
|
} |
|
122
|
|
|
|
|
123
|
|
|
/** |
|
124
|
|
|
* @param LoginUrl|null $login_url |
|
125
|
|
|
*/ |
|
126
|
|
|
public function setLoginUrl(?LoginUrl $login_url): void |
|
127
|
|
|
{ |
|
128
|
|
|
$this->login_url = $login_url; |
|
129
|
|
|
} |
|
130
|
|
|
|
|
131
|
|
|
/** |
|
132
|
|
|
* @return string|null |
|
133
|
|
|
*/ |
|
134
|
|
|
public function getCallbackData(): ?string |
|
135
|
|
|
{ |
|
136
|
|
|
return $this->callback_data; |
|
137
|
|
|
} |
|
138
|
|
|
|
|
139
|
|
|
/** |
|
140
|
|
|
* @param string|null $callback_data |
|
141
|
|
|
*/ |
|
142
|
|
|
public function setCallbackData(?string $callback_data): void |
|
143
|
|
|
{ |
|
144
|
|
|
$this->callback_data = $callback_data; |
|
145
|
|
|
} |
|
146
|
|
|
|
|
147
|
|
|
/** |
|
148
|
|
|
* @return string|null |
|
149
|
|
|
*/ |
|
150
|
|
|
public function getSwitchInlineQuery(): ?string |
|
151
|
|
|
{ |
|
152
|
|
|
return $this->switch_inline_query; |
|
153
|
|
|
} |
|
154
|
|
|
|
|
155
|
|
|
/** |
|
156
|
|
|
* @param string|null $switch_inline_query |
|
157
|
|
|
*/ |
|
158
|
|
|
public function setSwitchInlineQuery(?string $switch_inline_query): void |
|
159
|
|
|
{ |
|
160
|
|
|
$this->switch_inline_query = $switch_inline_query; |
|
161
|
|
|
} |
|
162
|
|
|
|
|
163
|
|
|
/** |
|
164
|
|
|
* @return string|null |
|
165
|
|
|
*/ |
|
166
|
|
|
public function getSwitchInlineQueryCurrentChat(): ?string |
|
167
|
|
|
{ |
|
168
|
|
|
return $this->switch_inline_query_current_chat; |
|
169
|
|
|
} |
|
170
|
|
|
|
|
171
|
|
|
/** |
|
172
|
|
|
* @param string|null $switch_inline_query_current_chat |
|
173
|
|
|
*/ |
|
174
|
|
|
public function setSwitchInlineQueryCurrentChat(?string $switch_inline_query_current_chat): void |
|
175
|
|
|
{ |
|
176
|
|
|
$this->switch_inline_query_current_chat = $switch_inline_query_current_chat; |
|
177
|
|
|
} |
|
178
|
|
|
|
|
179
|
|
|
/** |
|
180
|
|
|
* @return CallbackGame|null |
|
181
|
|
|
*/ |
|
182
|
|
|
public function getCallbackGame(): ?CallbackGame |
|
183
|
|
|
{ |
|
184
|
|
|
return $this->callback_game; |
|
185
|
|
|
} |
|
186
|
|
|
|
|
187
|
|
|
/** |
|
188
|
|
|
* @param CallbackGame|null $callback_game |
|
189
|
|
|
*/ |
|
190
|
|
|
public function setCallbackGame(?CallbackGame $callback_game): void |
|
191
|
|
|
{ |
|
192
|
|
|
$this->callback_game = $callback_game; |
|
193
|
|
|
} |
|
194
|
|
|
|
|
195
|
|
|
/** |
|
196
|
|
|
* @return bool|null |
|
197
|
|
|
*/ |
|
198
|
|
|
public function getPay(): ?bool |
|
199
|
|
|
{ |
|
200
|
|
|
return $this->pay; |
|
201
|
|
|
} |
|
202
|
|
|
|
|
203
|
|
|
/** |
|
204
|
|
|
* @param bool|null $pay |
|
205
|
|
|
*/ |
|
206
|
|
|
public function setPay(?bool $pay): void |
|
207
|
|
|
{ |
|
208
|
|
|
$this->pay = $pay; |
|
209
|
|
|
} |
|
210
|
|
|
|
|
211
|
|
|
} |