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.WebApps.pas
97 lines (79 loc) · 2.18 KB
/
TelegramBotApi.Types.WebApps.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
unit TelegramBotApi.Types.WebApps;
interface
uses
System.JSON.Serializers;
type
// Contains information about a Web App.
TtgWebAppInfo = class
private
[JsonName('text')]
FUrl: string;
public
// An HTTPS URL of a Web App to be opened with additional data
// as specified in Initializing Web Apps
property Url: string read FUrl write FUrl;
end;
TtgMenuButtonAbstract = class
private
[JsonName('type')]
FType: string;
public
constructor Create; virtual; abstract;
property &Type: string read FType write FType;
end;
// Represents a menu button, which opens the bot's list of commands.
TtgMenuButtonCommands = class(TtgMenuButtonAbstract)
public
constructor Create; override;
end;
// Represents a menu button, which launches a Web App.
TtgMenuButtonWebApp = class(TtgMenuButtonAbstract)
private
[JsonName('text')]
FText: string;
[JsonName('web_app')]
FWebApp: TtgWebAppInfo;
public
constructor Create; override;
destructor Destroy; override;
// Text on the button
property Text: string read FText write FText;
// 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.
property WebApp: TtgWebAppInfo read FWebApp write FWebApp;
end;
// Describes that no specific value for the menu button was set.
TtgMenuButtonDefault = class(TtgMenuButtonAbstract)
public
constructor Create; override;
end;
TtgMenuButton = class(TtgMenuButtonWebApp);
TtgSentWebAppMessage = class
private
FInlineMessageId: Int64;
public
property InlineMessageId: Int64 read FInlineMessageId write FInlineMessageId;
end;
implementation
{ TtgMenuButtonCommands }
constructor TtgMenuButtonCommands.Create;
begin
FType := 'commands';
end;
{ TtgMenuButtonWebApp }
constructor TtgMenuButtonWebApp.Create;
begin
FType := 'web_app';
FWebApp := TtgWebAppInfo.Create;
end;
destructor TtgMenuButtonWebApp.Destroy;
begin
FWebApp.Free;
inherited;
end;
{ TtgMenuButtonDefault }
constructor TtgMenuButtonDefault.Create;
begin
FType := 'default';
end;
end.