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.Request.Stickers.pas
306 lines (280 loc) · 12.3 KB
/
TelegramBotApi.Request.Stickers.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
{***************************************************************************}
{ }
{ 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.Request.Stickers;
interface
uses
CloudAPI.Attributes,
CloudAPI.Types,
TelegramBotApi.Types;
type
TtgAddStickerToSet = class abstract
private
[caName('user_id')]
[caIsRequaired]
[caDefaultValueInt64(0)]
FUserID: Int64;
[caName('name')]
[caIsRequaired]
[caDefaultValueString('')]
FName: string;
[caName('emojis')]
[caIsRequaired]
[caDefaultValueString('')]
FEmojis: string;
[caName('mask_position')]
FMaskPosition: TtgMaskPosition;
public
constructor Create; virtual; abstract;
/// <summary>
/// User identifier of created sticker set owner
/// </summary>
property UserID: Int64 read FUserID write FUserID;
/// <summary>
/// Short name of sticker set, to be used in t.me/addstickers/ URLs (e.g., animals).
/// Can contain only english letters, digits and underscores. Must begin with a
/// letter, can't contain consecutive underscores and must end in “_by_<bot
/// username>”. <bot_username> is case insensitive. 1-64 characters.
/// </summary>
property Name: string read FName write FName;
/// <summary>
/// One or more emoji corresponding to the sticker
/// </summary>
property Emojis: string read FEmojis write FEmojis;
/// <summary>
/// A JSON-serialized object for position where the mask should be placed on faces
/// </summary>
property MaskPosition: TtgMaskPosition read FMaskPosition write FMaskPosition;
end;
/// <summary> Use this method to add a new sticker to a set created by the bot. You
/// must use exactly one of the fields png_sticker, tgs_sticker, or webm_sticker.
/// Animated stickers can be added to animated sticker sets and only to them.
/// Animated sticker sets can have up to 50 stickers. Static sticker sets can have
/// up to 120 stickers. Returns True on success.</summary>
[caName('addStickerToSet')]
[caMethod(TcaMethod.POST)]
[caParameterType(TcaParameterType.QueryString)]
TtgAddStickerToSetPng = class(TtgAddStickerToSet)
private
[caName('png_sticker')]
[caDefaultValueString('')]
FPngSticker: TcaFileToSend;
public
constructor Create; override;
/// <summary>
/// PNG image with the sticker, must be up to 512 kilobytes in size, dimensions
/// must not exceed 512px, and either width or height must be exactly 512px. Pass a
/// file_id as a String to send a file that already exists on the Telegram servers,
/// pass an HTTP URL as a String for Telegram to get a file from the Internet, or
/// upload a new one using multipart/form-data. More info on Sending Files »
/// </summary>
property PngSticker: TcaFileToSend read FPngSticker write FPngSticker;
end;
/// <summary> Use this method to add a new sticker to a set created by the bot. You
/// must use exactly one of the fields png_sticker, tgs_sticker, or webm_sticker.
/// Animated stickers can be added to animated sticker sets and only to them.
/// Animated sticker sets can have up to 50 stickers. Static sticker sets can have
/// up to 120 stickers. Returns True on success.</summary>
[caName('addStickerToSet')]
[caMethod(TcaMethod.POST)]
[caParameterType(TcaParameterType.QueryString)]
TtgAddStickerToSetTgs = class(TtgAddStickerToSet)
private
[caName('tgs_sticker')]
[caDefaultValueString('')]
FTgsSticker: TcaFileToSend;
public
constructor Create; override;
/// <summary>
/// PNG image with the sticker, must be up to 512 kilobytes in size, dimensions
/// must not exceed 512px, and either width or height must be exactly 512px. Pass a
/// file_id as a String to send a file that already exists on the Telegram servers,
/// pass an HTTP URL as a String for Telegram to get a file from the Internet, or
/// upload a new one using multipart/form-data. More info on Sending Files »
/// </summary>
property PngSticker: TcaFileToSend read FTgsSticker write FTgsSticker;
end;
/// <summary> Use this method to add a new sticker to a set created by the bot. You
/// must use exactly one of the fields png_sticker, tgs_sticker, or webm_sticker.
/// Animated stickers can be added to animated sticker sets and only to them.
/// Animated sticker sets can have up to 50 stickers. Static sticker sets can have
/// up to 120 stickers. Returns True on success.</summary>
[caName('addStickerToSet')]
[caMethod(TcaMethod.POST)]
[caParameterType(TcaParameterType.QueryString)]
TtgAddStickerToSetWebM = class(TtgAddStickerToSet)
private
[caName('webm_sticker')]
[caDefaultValueString('')]
FWebMSticker: TcaFileToSend;
public
constructor Create; override;
/// <summary>
/// PNG image with the sticker, must be up to 512 kilobytes in size, dimensions
/// must not exceed 512px, and either width or height must be exactly 512px. Pass a
/// file_id as a String to send a file that already exists on the Telegram servers,
/// pass an HTTP URL as a String for Telegram to get a file from the Internet, or
/// upload a new one using multipart/form-data. More info on Sending Files »
/// </summary>
property WebMSticker: TcaFileToSend read FWebMSticker write FWebMSticker;
end;
TtgCreateNewStickerSet = class abstract(TtgAddStickerToSet)
private
[caName('title')]
[caIsRequaired]
[caDefaultValueString('')]
FTitle: string;
[caName('contains_masks')]
[caDefaultValueBoolean(False)]
FContainsMasks: Boolean;
public
/// <summary>
/// User identifier of created sticker set owner
/// </summary>
property UserID;
/// <summary>
/// Short name of sticker set, to be used in t.me/addstickers/ URLs (e.g., animals).
/// Can contain only english letters, digits and underscores. Must begin with a
/// letter, can't contain consecutive underscores and must end in “_by_<bot
/// username>”. <bot_username> is case insensitive. 1-64 characters.
/// </summary>
property Name;
/// <summary>
/// Sticker set title, 1-64 characters
/// </summary>
property Title: string read FTitle write FTitle;
/// <summary>
/// One or more emoji corresponding to the sticker
/// </summary>
property Emojis;
/// <summary>
/// Pass True, if a set of mask stickers should be created
/// </summary>
property ContainsMasks: Boolean read FContainsMasks write FContainsMasks;
/// <summary>
/// A JSON-serialized object for position where the mask should be placed on faces
/// </summary>
property MaskPosition;
end;
/// <summary> Use this method to create a new sticker set owned by a user. The bot
/// will be able to edit the sticker set thus created. You must use exactly one of
/// the fields png_sticker, tgs_sticker, or webm_sticker. Returns True on success.
/// </summary>
[caName('createNewStickerSet')]
[caMethod(TcaMethod.POST)]
[caParameterType(TcaParameterType.QueryString)]
TtgCreateNewStickerSetPng = class(TtgCreateNewStickerSet)
private
[caName('png_sticker')]
[caDefaultValueString('')]
FPngSticker: TcaFileToSend;
public
constructor Create; override;
/// <summary>
/// PNG image with the sticker, must be up to 512 kilobytes in size, dimensions
/// must not exceed 512px, and either width or height must be exactly 512px. Pass a
/// file_id as a String to send a file that already exists on the Telegram servers,
/// pass an HTTP URL as a String for Telegram to get a file from the Internet, or
/// upload a new one using multipart/form-data. More info on Sending Files »
/// </summary>
property PngSticker: TcaFileToSend read FPngSticker write FPngSticker;
end;
/// <summary> Use this method to create a new sticker set owned by a user. The bot
/// will be able to edit the sticker set thus created. You must use exactly one of
/// the fields png_sticker, tgs_sticker, or webm_sticker. Returns True on success.
/// </summary>
[caName('createNewStickerSet')]
[caMethod(TcaMethod.POST)]
[caParameterType(TcaParameterType.QueryString)]
TtgCreateNewStickerSetTgs = class(TtgCreateNewStickerSet)
private
[caName('tgs_sticker')]
[caDefaultValueString('')]
FTgsSticker: TcaFileToSend;
public
constructor Create; override;
/// <summary>
/// Tgs image with the sticker, must be up to 512 kilobytes in size, dimensions
/// must not exceed 512px, and either width or height must be exactly 512px. Pass a
/// file_id as a String to send a file that already exists on the Telegram servers,
/// pass an HTTP URL as a String for Telegram to get a file from the Internet, or
/// upload a new one using multipart/form-data. More info on Sending Files »
/// </summary>
property TgsSticker: TcaFileToSend read FTgsSticker write FTgsSticker;
end;
/// <summary> Use this method to create a new sticker set owned by a user. The bot
/// will be able to edit the sticker set thus created. You must use exactly one of
/// the fields png_sticker, tgs_sticker, or webm_sticker. Returns True on success.
/// </summary>
[caName('createNewStickerSet')]
[caMethod(TcaMethod.POST)]
[caParameterType(TcaParameterType.QueryString)]
TtgCreateNewStickerSetWebM = class(TtgCreateNewStickerSet)
private
[caName('webm_sticker')]
[caDefaultValueString('')]
FWebMSticker: TcaFileToSend;
public
constructor Create; override;
/// <summary>
/// WebM image with the sticker, must be up to 512 kilobytes in size, dimensions
/// must not exceed 512px, and either width or height must be exactly 512px. Pass a
/// file_id as a String to send a file that already exists on the Telegram servers,
/// pass an HTTP URL as a String for Telegram to get a file from the Internet, or
/// upload a new one using multipart/form-data. More info on Sending Files »
/// </summary>
property WebMSticker: TcaFileToSend read FWebMSticker write FWebMSticker;
end;
implementation
{ TtgCreateNewStickerSetPng }
constructor TtgCreateNewStickerSetPng.Create;
begin
FPngSticker := nil;
end;
{ TtgCreateNewStickerSetTgs }
constructor TtgCreateNewStickerSetTgs.Create;
begin
FTgsSticker := nil;
end;
{ TtgCreateNewStickerSetWebM }
constructor TtgCreateNewStickerSetWebM.Create;
begin
FWebMSticker := nil;
end;
{ TtgAddStickerToSetPng }
constructor TtgAddStickerToSetPng.Create;
begin
FPngSticker := nil;
end;
{ TtgAddStickerToSetTgs }
constructor TtgAddStickerToSetTgs.Create;
begin
FTgsSticker := nil;
end;
{ TtgAddStickerToSetWebM }
constructor TtgAddStickerToSetWebM.Create;
begin
FWebMSticker := nil;
end;
end.