This repository has been archived by the owner on Feb 12, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
/
TelegramBotApi.Types.Keyboards.pas
661 lines (606 loc) · 24 KB
/
TelegramBotApi.Types.Keyboards.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
{***************************************************************************}
{ }
{ TelegaPi }
{ }
{ Copyright (C) 2021 Maxim Sysoev }
{ }
{ https://t.me/CloudAPI }
{ }
{ }
{***************************************************************************}
{ }
{ Licensed under the Apache License, Version 2.0 (the "License"); }
{ you may not use this file except in compliance with the License. }
{ You may obtain a copy of the License at }
{ }
{ http://www.apache.org/licenses/LICENSE-2.0 }
{ }
{ Unless required by applicable law or agreed to in writing, software }
{ distributed under the License is distributed on an "AS IS" BASIS, }
{ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. }
{ See the License for the specific language governing permissions and }
{ limitations under the License. }
{ }
{***************************************************************************}
unit TelegramBotApi.Types.Keyboards;
interface
uses
System.JSON.Serializers,
TelegramBotApi.JSON.Converter,
TelegramBotApi.Types.WebApps;
type
{$REGION 'Abstract'}
TtgKeyboardAbstractProto = class(TObject);
TtgKeyboardAbstract<TtgButton: class, constructor> = class(TtgKeyboardAbstractProto)
protected
function ValidCoord(const ARow, ACol: Integer): Boolean;
procedure BuildCoord(const ARow, ACol: Integer);
function GetButton(const ARow, ACol: Integer): TtgButton; virtual;
procedure SetButton(const ARow, ACol: Integer; const Value: TtgButton); virtual;
function GetKeyboard: TArray<TArray<TtgButton>>; virtual; abstract;
procedure SetKeyboard(AKeyboard: TArray < TArray < TtgButton >> ); virtual; abstract;
public
constructor Create; virtual;
procedure Clear;
function RowCount: Integer; virtual;
function ButtonsCount(const ARow: Integer): Integer; virtual;
function AddButton: TtgButton; overload;
function AddButton<T: TtgButton>: TtgButton; overload;
function AddRow: Integer;
property Button[const ARow, ACol: Integer]: TtgButton read GetButton write SetButton; default;
end;
{$ENDREGION}
{$REGION 'Standard keyboards'}
/// <summary> This object represents one button of the reply keyboard. For simple
/// text buttons String can be used instead of this object to specify text of the
/// button. Optional fields request_contact, request_location, and request_poll are
/// mutually exclusive.
/// </summary>
/// <remarks>
/// Note: request_contact and request_location options will only work in Telegram
/// versions released after 9 April, 2016. Older clients will display unsupported
/// message.
/// Note: request_poll option will only work in Telegram versions released after 23
/// January, 2020. Older clients will display unsupported message.
/// </remarks>
TtgKeyboardButton = class(TObject)
private
[JsonName('text')]
FText: string;
[JsonName('request_contact')]
FRequestContact: Boolean;
[JsonName('request_location')]
FRequestLocation: Boolean;
[JsonName('web_app')]
FWebApp: TtgWebAppInfo;
function GetText: string;
procedure SetText(const Value: string);
public
constructor Create; virtual;
/// <summary>
/// Text of the button. If none of the optional fields are used, it will be sent as
/// a message when the button is pressed
/// </summary>
property Text: string read GetText write SetText;
/// <summary>
/// Optional. If True, the user's phone number will be sent as a contact when the
/// button is pressed. Available in private chats only
/// </summary>
property RequestContact: Boolean read FRequestContact write FRequestContact;
/// <summary>
/// Optional. If True, the user's current location will be sent when the button is
/// pressed. Available in private chats only
/// </summary>
property RequestLocation: Boolean read FRequestLocation write FRequestLocation;
/// <summary>
/// Optional. If specified, the described Web App will be launched when the button
/// is pressed. The Web App will be able to send a “web_app_data” service message.
/// Available in private chats only.
/// </summary>
property WebApp: TtgWebAppInfo read FWebApp write FWebApp;
end;
/// <summary>
/// This object represents type of a poll, which is allowed to be created and sent
/// when the corresponding button is pressed.
/// </summary>
TtgKeyboardButtonPollType = class
const
QUIZ = 'quiz';
REGULAR = 'regular';
private
[JsonName('type')]
FType: string;
public
constructor Create(const AType: string);
/// <summary>
/// Optional. If quiz is passed, the user will be allowed to create only polls in
/// the quiz mode. If regular is passed, only regular polls will be allowed.
/// Otherwise, the user will be allowed to create a poll of any type.
/// </summary>
{ TODO -oOwner -cGeneral : change to enum }
property &Type: string read FType write FType;
end;
TtgKeyboardButtonPool = class(TtgKeyboardButton)
private
[JsonName('request_poll')]
FRequestPoll: TtgKeyboardButtonPollType;
public
constructor Create; override;
destructor Destroy; override;
/// <summary>
/// Text of the button. If none of the optional fields are used, it will be sent as
/// a message when the button is pressed
/// </summary>
property Text;
/// <summary>
/// Optional. If True, the user's phone number will be sent as a contact when the
/// button is pressed. Available in private chats only
/// </summary>
property RequestContact;
/// <summary>
/// Optional. If True, the user's current location will be sent when the button is
/// pressed. Available in private chats only
/// </summary>
property RequestLocation;
/// <summary>
/// Optional. If specified, the user will be asked to create a poll and send it to
/// the bot when the button is pressed. Available in private chats only
/// </summary>
property RequestPoll: TtgKeyboardButtonPollType read FRequestPoll write FRequestPoll;
end;
/// <summary>
/// This object represents a custom keyboard with reply options (see Introduction
/// to bots for details and examples).
/// </summary>
TtgReplyKeyboardMarkup = class(TtgKeyboardAbstract<TtgKeyboardButton>)
private
[JsonName('keyboard')]
FKeyboard: TArray<TArray<TtgKeyboardButton>>;
[JsonName('resize_keyboard')]
FResizeKeyboard: Boolean;
[JsonName('one_time_keyboard')]
FOneTimeKeyboard: Boolean;
[JsonName('selective')]
FSelective: Boolean;
[JsonName('input_field_placeholder')]
FInputFieldPlaceholder: string;
protected
function GetKeyboard: TArray<TArray<TtgKeyboardButton>>; override;
procedure SetKeyboard(AKeyboard: TArray < TArray < TtgKeyboardButton >> ); override;
public
constructor Create; override;
function AddButtonPool: TtgKeyboardButtonPool;
/// <summary>
/// Array of button rows, each represented by an Array of KeyboardButton objects
/// </summary>
property Keyboard: TArray < TArray < TtgKeyboardButton >> read FKeyboard write FKeyboard;
/// <summary>
/// Optional. Requests clients to resize the keyboard vertically for optimal fit (e.
/// g., make the keyboard smaller if there are just two rows of buttons). Defaults
/// to false, in which case the custom keyboard is always of the same height as the
/// app's standard keyboard.
/// </summary>
property ResizeKeyboard: Boolean read FResizeKeyboard write FResizeKeyboard;
/// <summary>
/// Optional. Requests clients to hide the keyboard as soon as it's been used. The
/// keyboard will still be available, but clients will automatically display the
/// usual letter-keyboard in the chat – the user can press a special button in the
/// input field to see the custom keyboard again. Defaults to false.
/// </summary>
property OneTimeKeyboard: Boolean read FOneTimeKeyboard write FOneTimeKeyboard;
/// <summary>
/// Optional. The placeholder to be shown in the input field when the keyboard is
/// active; 1-64 characters
/// </summary>
property InputFieldPlaceholder: string read FInputFieldPlaceholder write FInputFieldPlaceholder;
/// <summary>
/// Optional. Use this parameter if you want to show the keyboard to specific users
/// only. Targets: 1) users that are @mentioned in the text of the Message object;
/// 2) if the bot's message is a reply (has reply_to_message_id), sender of the
/// original message.
///
/// Example: A user requests to change the bot's language, bot replies to the
/// request with a keyboard to select the new language. Other users in the group
/// don't see the keyboard.
/// </summary>
property Selective: Boolean read FSelective write FSelective;
end;
/// <summary>
/// Upon receiving a message with this object, Telegram clients will remove the
/// current custom keyboard and display the default letter-keyboard. By default,
/// custom keyboards are displayed until a new keyboard is sent by a bot. An
/// exception is made for one-time keyboards that are hidden immediately after the
/// user presses a button (see ReplyKeyboardMarkup).
/// </summary>
TtgReplyKeyboardRemove = class(TtgKeyboardAbstractProto)
private
[JsonName('remove_keyboard')]
FRemoveKeyboard: Boolean;
[JsonName('selective')]
FSelective: Boolean;
public
constructor Create;
/// <summary>
/// Requests clients to remove the custom keyboard (user will not be able to summon
/// this keyboard; if you want to hide the keyboard from sight but keep it
/// accessible, use one_time_keyboard in ReplyKeyboardMarkup)
/// </summary>
property RemoveKeyboard: Boolean read FRemoveKeyboard write FRemoveKeyboard;
/// <summary>
/// Optional. Use this parameter if you want to remove the keyboard for specific
/// users only. Targets: 1) users that are @mentioned in the text of the Message
/// object; 2) if the bot's message is a reply (has reply_to_message_id), sender of
/// the original message.
///
/// Example: A user votes in a poll, bot returns confirmation message in reply to
/// the vote and removes the keyboard for that user, while still showing the
/// keyboard with poll options to users who haven't voted yet.
/// </summary>
property Selective: Boolean read FSelective write FSelective;
end;
/// <summary>
/// Upon receiving a message with this object, Telegram clients will display a
/// reply interface to the user (act as if the user has selected the bot's message
/// and tapped 'Reply'). This can be extremely useful if you want to create
/// user-friendly step-by-step interfaces without having to sacrifice privacy mode.
/// </summary>
TtgForceReply = class
private
[JsonName('force_reply')]
FForceReply: Boolean;
[JsonName('selective')]
FSelective: Boolean;
[JsonName('input_field_placeholder')]
FInputFieldPlaceholder: string;
public
/// <summary>
/// Shows reply interface to the user, as if they manually selected the bot's
/// message and tapped 'Reply'
/// </summary>
property ForceReply: Boolean read FForceReply write FForceReply;
/// <summary>
/// Optional. The placeholder to be shown in the input field when the reply is
/// active; 1-64 characters
/// </summary>
property InputFieldPlaceholder: string read FInputFieldPlaceholder write FInputFieldPlaceholder;
/// <summary>
/// Optional. Use this parameter if you want to force reply from specific users
/// only. Targets: 1) users that are @mentioned in the text of the Message object;
/// 2) if the bot's message is a reply (has reply_to_message_id), sender of the
/// original message.
/// </summary>
property Selective: Boolean read FSelective write FSelective;
end;
{$ENDREGION}
{$REGION 'Inline keyboards'}
/// <summary>
/// This object represents a parameter of the inline keyboard button used to
/// automatically authorize a user. Serves as a great replacement for the Telegram
/// Login Widget when the user is coming from Telegram. All the user needs to do is
/// tap/click a button and confirm that they want to log in:
///
/// TITLE
/// Telegram apps support these buttons as of version 5.7.
///
/// Sample bot: @discussbot
/// </summary>
TtgLoginUrl = class
private
[JsonName('url')]
FUrl: string;
[JsonName('forward_text')]
FForwardText: string;
[JsonName('bot_username')]
FBotUsername: string;
[JsonName('request_write_access')]
FRequestWriteAccess: Boolean;
public
/// <summary>
/// An HTTP URL to be opened with user authorization data added to the query string
/// when the button is pressed. If the user refuses to provide authorization data,
/// the original URL without information about the user will be opened. The data
/// added is the same as described in Receiving authorization data.
///
/// NOTE: You must always check the hash of the received data to verify the
/// authentication and the integrity of the data as described in Checking
/// authorization.
/// </summary>
property Url: string read FUrl write FUrl;
/// <summary>
/// Optional. New text of the button in forwarded messages.
/// </summary>
property ForwardText: string read FForwardText write FForwardText;
/// <summary>
/// Optional. Username of a bot, which will be used for user authorization. See
/// Setting up a bot for more details. If not specified, the current bot's username
/// will be assumed. The url's domain must be the same as the domain linked with
/// the bot. See Linking your domain to the bot for more details.
/// </summary>
property BotUsername: string read FBotUsername write FBotUsername;
/// <summary>
/// Optional. Pass True to request the permission for your bot to send messages to
/// the user.
/// </summary>
property RequestWriteAccess: Boolean read FRequestWriteAccess write FRequestWriteAccess;
end;
{ TODO -oOwner -cGeneral : Создать объект }
TtgCallbackGame = class(TObject);
/// <summary>
/// This object represents one button of an inline keyboard. You must use exactly
/// one of the optional fields.
/// </summary>
TtgInlineKeyboardButton = class
private
[JsonName('text')]
FText: string;
[JsonName('url')]
FUrl: string;
[JsonName('login_url')]
FLoginUrl: TtgLoginUrl;
[JsonName('callback_data')]
FCallbackData: string;
[JsonName('web_app')]
FWebApp: TtgWebAppInfo;
[JsonName('switch_inline_query')]
FSwitchInlineQuery: string;
[JsonName('switch_inline_query_current_chat')]
FSwitchInlineQueryCurrentChat: string;
[JsonName('callback_game')]
FCallbackGame: TtgCallbackGame;
[JsonName('pay')]
FPay: Boolean;
public
/// <summary>
/// Label text on the button
/// </summary>
property Text: string read FText write FText;
/// <summary>
/// Optional. HTTP or tg:// url to be opened when button is pressed
/// </summary>
property Url: string read FUrl write FUrl;
/// <summary>
/// Optional. An HTTP URL used to automatically authorize the user. Can be used as
/// a replacement for the Telegram Login Widget.
/// </summary>
property LoginUrl: TtgLoginUrl read FLoginUrl write FLoginUrl;
/// <summary>
/// Optional. Data to be sent in a callback query to the bot when button is pressed,
/// 1-64 bytes
/// </summary>
property CallbackData: string read FCallbackData write FCallbackData;
/// <summary> Optional. Description of the Web App that will be launched when the
/// user presses the button. The Web App will be able to send an arbitrary message
/// on behalf of the user using the method answerWebAppQuery. Available only in
/// private chats between a user and the bot.
/// </summary>
property WebApp: TtgWebAppInfo read FWebApp write FWebApp;
/// <summary>
/// Optional. If set, pressing the button will prompt the user to select one of
/// their chats, open that chat and insert the bot's username and the specified
/// inline query in the input field. Can be empty, in which case just the bot's
/// username will be inserted.
///
/// Note: This offers an easy way for users to start using your bot in inline mode
/// when they are currently in a private chat with it. Especially useful when
/// combined with switch_pm… actions – in this case the user will be automatically
/// returned to the chat they switched from, skipping the chat selection screen.
/// </summary>
property SwitchInlineQuery: string read FSwitchInlineQuery write FSwitchInlineQuery;
/// <summary>
/// Optional. If set, pressing the button will insert the bot's username and the
/// specified inline query in the current chat's input field. Can be empty, in
/// which case only the bot's username will be inserted.
///
/// This offers a quick way for the user to open your bot in inline mode in the
/// same chat – good for selecting something from multiple options.
/// </summary>
property SwitchInlineQueryCurrentChat: string read FSwitchInlineQueryCurrentChat
write FSwitchInlineQueryCurrentChat;
/// <summary>
/// Optional. Description of the game that will be launched when the user presses
/// the button.
///
/// NOTE: This type of button must always be the first button in the first row.
/// </summary>
property CallbackGame: TtgCallbackGame read FCallbackGame write FCallbackGame;
/// <summary>
/// Optional. Specify True, to send a Pay button.
///
/// NOTE: This type of button must always be the first button in the first row.
/// </summary>
property Pay: Boolean read FPay write FPay;
end;
/// <summary>
/// This object represents an inline keyboard that appears right next to the
/// message it belongs to.
/// </summary>
TtgInlineKeyboardMarkup = class(TtgKeyboardAbstract<TtgInlineKeyboardButton>)
private
[JsonName('inline_keyboard')]
FInlineKeyboard: TArray<TArray<TtgInlineKeyboardButton>>;
protected
function GetKeyboard: TArray<TArray<TtgInlineKeyboardButton>>; override;
procedure SetKeyboard(AKeyboard: TArray < TArray < TtgInlineKeyboardButton >> ); override;
public
/// <summary>
/// Array of button rows, each represented by an Array of InlineKeyboardButton
/// objects
/// </summary>
property InlineKeyboard: TArray < TArray < TtgInlineKeyboardButton >> read FInlineKeyboard write FInlineKeyboard;
end;
{$ENDREGION}
TtgKeyboardBuilder = class
class function InlineKb: TtgInlineKeyboardMarkup;
class function ReplyKb: TtgReplyKeyboardMarkup;
class function ForceReply: TtgForceReply;
class function RemoveKb: TtgReplyKeyboardRemove;
end;
implementation
{ TtgKeyboardButton }
constructor TtgKeyboardButton.Create;
begin
FText := '';
FRequestContact := False;
FRequestLocation := False;
end;
function TtgKeyboardButton.GetText: string;
begin
Result := FText;
end;
procedure TtgKeyboardButton.SetText(const Value: string);
begin
FText := Value;
end;
function TtgReplyKeyboardMarkup.AddButtonPool: TtgKeyboardButtonPool;
var
lRowCount: Integer;
lBtnCount: Integer;
begin
Result := TtgKeyboardButtonPool.Create;
lRowCount := RowCount;
lBtnCount := ButtonsCount(lRowCount - 1);
Button[lRowCount - 1, lBtnCount] := Result;
end;
constructor TtgReplyKeyboardMarkup.Create;
begin
inherited Create;
FResizeKeyboard := True;
end;
{ TtgKeyboardBuilder }
class function TtgKeyboardBuilder.ForceReply: TtgForceReply;
begin
Result := TtgForceReply.Create;
end;
class function TtgKeyboardBuilder.InlineKb: TtgInlineKeyboardMarkup;
begin
Result := TtgInlineKeyboardMarkup.Create;
end;
class function TtgKeyboardBuilder.RemoveKb: TtgReplyKeyboardRemove;
begin
Result := TtgReplyKeyboardRemove.Create;
end;
class function TtgKeyboardBuilder.ReplyKb: TtgReplyKeyboardMarkup;
begin
Result := TtgReplyKeyboardMarkup.Create;
end;
{ TtgKeyboardAbstract<TtgButton> }
procedure TtgKeyboardAbstract<TtgButton>.BuildCoord(const ARow, ACol: Integer);
var
lKeyboard: TArray<TArray<TtgButton>>;
begin
lKeyboard := GetKeyboard;
if Length(lKeyboard) <= ARow then
SetLength(lKeyboard, ARow + 1);
if Length(lKeyboard[ARow]) <= ACol then
SetLength(lKeyboard[ARow], ACol + 1);
SetKeyboard(lKeyboard);
end;
function TtgKeyboardAbstract<TtgButton>.ButtonsCount(const ARow: Integer): Integer;
var
lRowCount: Integer;
begin
lRowCount := RowCount;
if lRowCount > ARow then
Result := Length(GetKeyboard[ARow])
else
Result := 0;
end;
procedure TtgKeyboardAbstract<TtgButton>.Clear;
var
lKb: TArray<TArray<TtgButton>>;
I, J: Integer;
begin
lKb := GetKeyboard;
for I := High(lKb) downto Low(lKb) do
for J := High(lKb) to Low(lKb) do
lKb[I, J].Free;
lKb := nil;
SetKeyboard(lKb);
end;
constructor TtgKeyboardAbstract<TtgButton>.Create;
begin
AddRow;
end;
function TtgKeyboardAbstract<TtgButton>.GetButton(const ARow, ACol: Integer): TtgButton;
begin
if not ValidCoord(ARow, ACol) then
Result := Default (TtgButton)
else
Result := GetKeyboard[ARow, ACol];
end;
function TtgKeyboardAbstract<TtgButton>.AddButton: TtgButton;
begin
Result := AddButton<TtgButton>;
end;
function TtgKeyboardAbstract<TtgButton>.AddButton<T>: TtgButton;
var
lRowCount: Integer;
lBtnCount: Integer;
begin
Result := TtgButton.Create;
lRowCount := RowCount;
lBtnCount := ButtonsCount(lRowCount - 1);
Button[lRowCount - 1, lBtnCount] := Result;
end;
function TtgKeyboardAbstract<TtgButton>.AddRow: Integer;
var
lKeyboard: TArray<TArray<TtgButton>>;
begin
lKeyboard := GetKeyboard;
SetLength(lKeyboard, Length(lKeyboard) + 1);
SetKeyboard(lKeyboard);
end;
function TtgKeyboardAbstract<TtgButton>.RowCount: Integer;
begin
Result := Length(GetKeyboard);
end;
procedure TtgKeyboardAbstract<TtgButton>.SetButton(const ARow, ACol: Integer; const Value: TtgButton);
begin
if not ValidCoord(ARow, ACol) then
BuildCoord(ARow, ACol);
GetKeyboard[ARow, ACol] := Value;
end;
function TtgKeyboardAbstract<TtgButton>.ValidCoord(const ARow, ACol: Integer): Boolean;
begin
Result := (Length(GetKeyboard) > ARow) and (Length(GetKeyboard[ARow]) > ACol);
end;
function TtgInlineKeyboardMarkup.GetKeyboard: TArray<TArray<TtgInlineKeyboardButton>>;
begin
Result := FInlineKeyboard;
end;
procedure TtgInlineKeyboardMarkup.SetKeyboard(AKeyboard: TArray < TArray < TtgInlineKeyboardButton >> );
begin
inherited;
FInlineKeyboard := AKeyboard;
end;
function TtgReplyKeyboardMarkup.GetKeyboard: TArray<TArray<TtgKeyboardButton>>;
begin
Result := FKeyboard;
end;
procedure TtgReplyKeyboardMarkup.SetKeyboard(AKeyboard: TArray < TArray < TtgKeyboardButton >> );
begin
inherited;
FKeyboard := AKeyboard;
end;
{ TtgKeyboardButtonPollType }
constructor TtgKeyboardButtonPollType.Create(const AType: string);
begin
FType := AType;
end;
{ TtgKeyboardButtonPool }
constructor TtgKeyboardButtonPool.Create;
begin
inherited Create;
FRequestPoll := TtgKeyboardButtonPollType.Create(FRequestPoll.QUIZ);
end;
destructor TtgKeyboardButtonPool.Destroy;
begin
FRequestPoll.Free;
inherited;
end;
{ TtgReplyKeyboardRemove }
constructor TtgReplyKeyboardRemove.Create;
begin
FRemoveKeyboard := True;
end;
end.