RubigramClient 1.6.6__py3-none-any.whl → 1.6.8__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of RubigramClient might be problematic. Click here for more details.
- rubigram/__init__.py +1 -0
- rubigram/client.py +80 -50
- rubigram/enums.py +9 -1
- rubigram/method.py +75 -21
- rubigram/network.py +37 -21
- rubigram/rubino/__init__.py +1 -0
- rubigram/rubino/client.py +82 -0
- rubigram/types.py +584 -25
- {rubigramclient-1.6.6.dist-info → rubigramclient-1.6.8.dist-info}/METADATA +22 -2
- rubigramclient-1.6.8.dist-info/RECORD +15 -0
- rubigramclient-1.6.6.dist-info/RECORD +0 -13
- {rubigramclient-1.6.6.dist-info → rubigramclient-1.6.8.dist-info}/WHEEL +0 -0
- {rubigramclient-1.6.6.dist-info → rubigramclient-1.6.8.dist-info}/licenses/LICENSE +0 -0
- {rubigramclient-1.6.6.dist-info → rubigramclient-1.6.8.dist-info}/top_level.txt +0 -0
rubigram/types.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from typing import Optional, Any
|
|
1
|
+
from typing import Optional, Union, Any
|
|
2
2
|
from pydantic import BaseModel
|
|
3
3
|
from rubigram import enums
|
|
4
4
|
|
|
@@ -28,12 +28,48 @@ class Chat(DataManager):
|
|
|
28
28
|
title: Optional[str] = None
|
|
29
29
|
username: Optional[str] = None
|
|
30
30
|
|
|
31
|
+
def __init__(
|
|
32
|
+
self,
|
|
33
|
+
chat_id: Optional[str] = None,
|
|
34
|
+
chat_type: Optional[enums.ChatType] = None,
|
|
35
|
+
user_id: Optional[str] = None,
|
|
36
|
+
first_name: Optional[str] = None,
|
|
37
|
+
last_name: Optional[str] = None,
|
|
38
|
+
title: Optional[str] = None,
|
|
39
|
+
username: Optional[str] = None,
|
|
40
|
+
**kwargs
|
|
41
|
+
):
|
|
42
|
+
super().__init__(
|
|
43
|
+
chat_id=chat_id,
|
|
44
|
+
chat_type=chat_type,
|
|
45
|
+
user_id=user_id,
|
|
46
|
+
first_name=first_name,
|
|
47
|
+
last_name=last_name,
|
|
48
|
+
title=title,
|
|
49
|
+
username=username,
|
|
50
|
+
**kwargs
|
|
51
|
+
)
|
|
52
|
+
|
|
31
53
|
|
|
32
54
|
class File(DataManager):
|
|
33
55
|
file_id: Optional[str] = None
|
|
34
56
|
file_name: Optional[str] = None
|
|
35
57
|
size: Optional[str] = None
|
|
36
58
|
|
|
59
|
+
def __init__(
|
|
60
|
+
self,
|
|
61
|
+
file_id: Optional[str] = None,
|
|
62
|
+
file_name: Optional[str] = None,
|
|
63
|
+
size: Optional[str] = None,
|
|
64
|
+
**kwargs
|
|
65
|
+
):
|
|
66
|
+
super().__init__(
|
|
67
|
+
file_id=file_id,
|
|
68
|
+
file_name=file_name,
|
|
69
|
+
size=size,
|
|
70
|
+
**kwargs
|
|
71
|
+
)
|
|
72
|
+
|
|
37
73
|
|
|
38
74
|
class ForwardedFrom(DataManager):
|
|
39
75
|
type_from: Optional[enums.ForwardedFrom] = None
|
|
@@ -41,16 +77,56 @@ class ForwardedFrom(DataManager):
|
|
|
41
77
|
from_chat_id: Optional[str] = None
|
|
42
78
|
from_sender_id: Optional[str] = None
|
|
43
79
|
|
|
80
|
+
def __init__(
|
|
81
|
+
self,
|
|
82
|
+
type_from: Optional[enums.ForwardedFrom] = None,
|
|
83
|
+
message_id: Optional[str] = None,
|
|
84
|
+
from_chat_id: Optional[str] = None,
|
|
85
|
+
from_sender_id: Optional[str] = None,
|
|
86
|
+
**kwargs
|
|
87
|
+
):
|
|
88
|
+
super().__init__(
|
|
89
|
+
type_from=type_from,
|
|
90
|
+
message_id=message_id,
|
|
91
|
+
from_chat_id=from_chat_id,
|
|
92
|
+
from_sender_id=from_sender_id,
|
|
93
|
+
**kwargs
|
|
94
|
+
)
|
|
95
|
+
|
|
44
96
|
|
|
45
97
|
class PaymentStatus(DataManager):
|
|
46
98
|
payment_id: Optional[str] = None
|
|
47
99
|
status: Optional[enums.PaymentStatus] = None
|
|
48
100
|
|
|
101
|
+
def __init__(
|
|
102
|
+
self,
|
|
103
|
+
payment_id: Optional[str] = None,
|
|
104
|
+
status: Optional[enums.PaymentStatus] = None,
|
|
105
|
+
**kwargs
|
|
106
|
+
):
|
|
107
|
+
super().__init__(
|
|
108
|
+
payment_id=payment_id,
|
|
109
|
+
status=status,
|
|
110
|
+
**kwargs
|
|
111
|
+
)
|
|
112
|
+
|
|
49
113
|
|
|
50
114
|
class MessageTextUpdate(DataManager):
|
|
51
115
|
message_id: Optional[str] = None
|
|
52
116
|
text: Optional[str] = None
|
|
53
117
|
|
|
118
|
+
def __init__(
|
|
119
|
+
self,
|
|
120
|
+
message_id: Optional[str] = None,
|
|
121
|
+
text: Optional[str] = None,
|
|
122
|
+
**kwargs
|
|
123
|
+
):
|
|
124
|
+
super().__init__(
|
|
125
|
+
message_id=message_id,
|
|
126
|
+
text=text,
|
|
127
|
+
**kwargs
|
|
128
|
+
)
|
|
129
|
+
|
|
54
130
|
|
|
55
131
|
class Bot(DataManager):
|
|
56
132
|
bot_id: Optional[str] = None
|
|
@@ -61,23 +137,85 @@ class Bot(DataManager):
|
|
|
61
137
|
start_message: Optional[str] = None
|
|
62
138
|
share_url: Optional[str] = None
|
|
63
139
|
|
|
140
|
+
def __init__(
|
|
141
|
+
self,
|
|
142
|
+
bot_id: Optional[str] = None,
|
|
143
|
+
bot_title: Optional[str] = None,
|
|
144
|
+
avatar: Optional[File] = None,
|
|
145
|
+
description: Optional[str] = None,
|
|
146
|
+
username: Optional[str] = None,
|
|
147
|
+
start_message: Optional[str] = None,
|
|
148
|
+
share_url: Optional[str] = None,
|
|
149
|
+
**kwargs
|
|
150
|
+
):
|
|
151
|
+
super().__init__(
|
|
152
|
+
bot_id=bot_id,
|
|
153
|
+
bot_title=bot_title,
|
|
154
|
+
avatar=avatar,
|
|
155
|
+
description=description,
|
|
156
|
+
username=username,
|
|
157
|
+
start_message=start_message,
|
|
158
|
+
share_url=share_url,
|
|
159
|
+
**kwargs
|
|
160
|
+
)
|
|
161
|
+
|
|
64
162
|
|
|
65
163
|
class BotCommand(DataManager):
|
|
66
164
|
command: Optional[str] = None
|
|
67
165
|
description: Optional[str] = None
|
|
68
166
|
|
|
167
|
+
def __init__(
|
|
168
|
+
self,
|
|
169
|
+
command: Optional[str] = None,
|
|
170
|
+
description: Optional[str] = None,
|
|
171
|
+
**kwargs
|
|
172
|
+
):
|
|
173
|
+
super().__init__(
|
|
174
|
+
command=command,
|
|
175
|
+
description=description,
|
|
176
|
+
**kwargs
|
|
177
|
+
)
|
|
178
|
+
|
|
69
179
|
|
|
70
180
|
class Sticker(DataManager):
|
|
71
181
|
sticker_id: Optional[str] = None
|
|
72
182
|
file: Optional[File] = None
|
|
73
183
|
emoji_character: Optional[str] = None
|
|
74
184
|
|
|
185
|
+
def __init__(
|
|
186
|
+
self,
|
|
187
|
+
sticker_id: Optional[str] = None,
|
|
188
|
+
file: Optional[File] = None,
|
|
189
|
+
emoji_character: Optional[str] = None,
|
|
190
|
+
**kwargs
|
|
191
|
+
):
|
|
192
|
+
super().__init__(
|
|
193
|
+
sticker_id=sticker_id,
|
|
194
|
+
file=file,
|
|
195
|
+
emoji_character=emoji_character,
|
|
196
|
+
**kwargs
|
|
197
|
+
)
|
|
198
|
+
|
|
75
199
|
|
|
76
200
|
class ContactMessage(DataManager):
|
|
77
201
|
phone_number: Optional[str] = None
|
|
78
202
|
first_name: Optional[str] = None
|
|
79
203
|
last_name: Optional[str] = None
|
|
80
204
|
|
|
205
|
+
def __init__(
|
|
206
|
+
self,
|
|
207
|
+
phone_number: Optional[str] = None,
|
|
208
|
+
first_name: Optional[str] = None,
|
|
209
|
+
last_name: Optional[str] = None,
|
|
210
|
+
**kwargs
|
|
211
|
+
):
|
|
212
|
+
super().__init__(
|
|
213
|
+
phone_number=phone_number,
|
|
214
|
+
first_name=first_name,
|
|
215
|
+
last_name=last_name,
|
|
216
|
+
**kwargs
|
|
217
|
+
)
|
|
218
|
+
|
|
81
219
|
|
|
82
220
|
class PollStatus(DataManager):
|
|
83
221
|
state: Optional[enums.PollStatus] = None
|
|
@@ -86,17 +224,61 @@ class PollStatus(DataManager):
|
|
|
86
224
|
total_vote: Optional[int] = None
|
|
87
225
|
show_total_votes: Optional[bool] = None
|
|
88
226
|
|
|
227
|
+
def __init__(
|
|
228
|
+
self,
|
|
229
|
+
state: Optional[enums.PollStatus] = None,
|
|
230
|
+
selection_index: Optional[int] = None,
|
|
231
|
+
percent_vote_options: Optional[list[int]] = None,
|
|
232
|
+
total_vote: Optional[int] = None,
|
|
233
|
+
show_total_votes: Optional[bool] = None,
|
|
234
|
+
**kwargs
|
|
235
|
+
):
|
|
236
|
+
super().__init__(
|
|
237
|
+
state=state,
|
|
238
|
+
selection_index=selection_index,
|
|
239
|
+
percent_vote_options=percent_vote_options,
|
|
240
|
+
total_vote=total_vote,
|
|
241
|
+
show_total_votes=show_total_votes,
|
|
242
|
+
**kwargs
|
|
243
|
+
)
|
|
244
|
+
|
|
89
245
|
|
|
90
246
|
class Poll(DataManager):
|
|
91
247
|
question: Optional[str] = None
|
|
92
248
|
options: Optional[list[str]] = None
|
|
93
249
|
poll_status: Optional[PollStatus] = None
|
|
94
250
|
|
|
251
|
+
def __init__(
|
|
252
|
+
self,
|
|
253
|
+
question: Optional[str] = None,
|
|
254
|
+
options: Optional[list[str]] = None,
|
|
255
|
+
poll_status: Optional[PollStatus] = None,
|
|
256
|
+
**kwargs
|
|
257
|
+
):
|
|
258
|
+
super().__init__(
|
|
259
|
+
question=question,
|
|
260
|
+
options=options,
|
|
261
|
+
poll_status=poll_status,
|
|
262
|
+
**kwargs
|
|
263
|
+
)
|
|
264
|
+
|
|
95
265
|
|
|
96
266
|
class Location(DataManager):
|
|
97
267
|
longitude: Optional[str] = None
|
|
98
268
|
latitude: Optional[str] = None
|
|
99
269
|
|
|
270
|
+
def __init__(
|
|
271
|
+
self,
|
|
272
|
+
longitude: Optional[str] = None,
|
|
273
|
+
latitude: Optional[str] = None,
|
|
274
|
+
**kwargs
|
|
275
|
+
):
|
|
276
|
+
super().__init__(
|
|
277
|
+
longitude=longitude,
|
|
278
|
+
latitude=latitude,
|
|
279
|
+
**kwargs
|
|
280
|
+
)
|
|
281
|
+
|
|
100
282
|
|
|
101
283
|
class LiveLocation(DataManager):
|
|
102
284
|
start_time: Optional[str] = None
|
|
@@ -106,12 +288,46 @@ class LiveLocation(DataManager):
|
|
|
106
288
|
status: Optional[enums.LiveLocationStatus] = None
|
|
107
289
|
last_update_time: Optional[str] = None
|
|
108
290
|
|
|
291
|
+
def __init__(
|
|
292
|
+
self,
|
|
293
|
+
start_time: Optional[str] = None,
|
|
294
|
+
live_period: Optional[int] = None,
|
|
295
|
+
current_location: Optional[Location] = None,
|
|
296
|
+
user_id: Optional[str] = None,
|
|
297
|
+
status: Optional[enums.LiveLocationStatus] = None,
|
|
298
|
+
last_update_time: Optional[str] = None,
|
|
299
|
+
**kwargs
|
|
300
|
+
):
|
|
301
|
+
super().__init__(
|
|
302
|
+
start_time=start_time,
|
|
303
|
+
live_period=live_period,
|
|
304
|
+
current_location=current_location,
|
|
305
|
+
user_id=user_id,
|
|
306
|
+
status=status,
|
|
307
|
+
last_update_time=last_update_time,
|
|
308
|
+
**kwargs
|
|
309
|
+
)
|
|
310
|
+
|
|
109
311
|
|
|
110
312
|
class ButtonSelectionItem(DataManager):
|
|
111
313
|
text: Optional[str] = None
|
|
112
314
|
image_url: Optional[str] = None
|
|
113
315
|
type: Optional[enums.ButtonSelectionType] = None
|
|
114
316
|
|
|
317
|
+
def __init__(
|
|
318
|
+
self,
|
|
319
|
+
text: Optional[str] = None,
|
|
320
|
+
image_url: Optional[str] = None,
|
|
321
|
+
type: Optional[enums.ButtonSelectionType] = None,
|
|
322
|
+
**kwargs
|
|
323
|
+
):
|
|
324
|
+
super().__init__(
|
|
325
|
+
text=text,
|
|
326
|
+
image_url=image_url,
|
|
327
|
+
type=type,
|
|
328
|
+
**kwargs
|
|
329
|
+
)
|
|
330
|
+
|
|
115
331
|
|
|
116
332
|
class ButtonSelection(DataManager):
|
|
117
333
|
selection_id: Optional[str] = None
|
|
@@ -122,6 +338,28 @@ class ButtonSelection(DataManager):
|
|
|
122
338
|
columns_count: Optional[str] = None
|
|
123
339
|
title: Optional[str] = None
|
|
124
340
|
|
|
341
|
+
def __init__(
|
|
342
|
+
self,
|
|
343
|
+
selection_id: Optional[str] = None,
|
|
344
|
+
search_type: Optional[str] = None,
|
|
345
|
+
get_type: Optional[str] = None,
|
|
346
|
+
items: Optional[list[ButtonSelectionItem]] = None,
|
|
347
|
+
is_multi_selection: Optional[bool] = None,
|
|
348
|
+
columns_count: Optional[str] = None,
|
|
349
|
+
title: Optional[str] = None,
|
|
350
|
+
**kwargs
|
|
351
|
+
):
|
|
352
|
+
super().__init__(
|
|
353
|
+
selection_id=selection_id,
|
|
354
|
+
search_type=search_type,
|
|
355
|
+
get_type=get_type,
|
|
356
|
+
items=items,
|
|
357
|
+
is_multi_selection=is_multi_selection,
|
|
358
|
+
columns_count=columns_count,
|
|
359
|
+
title=title,
|
|
360
|
+
**kwargs
|
|
361
|
+
)
|
|
362
|
+
|
|
125
363
|
|
|
126
364
|
class ButtonCalendar(DataManager):
|
|
127
365
|
default_value: Optional[str] = None
|
|
@@ -130,6 +368,24 @@ class ButtonCalendar(DataManager):
|
|
|
130
368
|
max_year: Optional[str] = None
|
|
131
369
|
title: Optional[str] = None
|
|
132
370
|
|
|
371
|
+
def __init__(
|
|
372
|
+
self,
|
|
373
|
+
default_value: Optional[str] = None,
|
|
374
|
+
type: Optional[enums.ButtonCalendarType] = None,
|
|
375
|
+
min_year: Optional[str] = None,
|
|
376
|
+
max_year: Optional[str] = None,
|
|
377
|
+
title: Optional[str] = None,
|
|
378
|
+
**kwargs
|
|
379
|
+
):
|
|
380
|
+
super().__init__(
|
|
381
|
+
default_value=default_value,
|
|
382
|
+
type=type,
|
|
383
|
+
min_year=min_year,
|
|
384
|
+
max_year=max_year,
|
|
385
|
+
title=title,
|
|
386
|
+
**kwargs
|
|
387
|
+
)
|
|
388
|
+
|
|
133
389
|
|
|
134
390
|
class ButtonNumberPicker(DataManager):
|
|
135
391
|
min_value: Optional[str] = None
|
|
@@ -137,12 +393,42 @@ class ButtonNumberPicker(DataManager):
|
|
|
137
393
|
default_value: Optional[str] = None
|
|
138
394
|
title: Optional[str] = None
|
|
139
395
|
|
|
396
|
+
def __init__(
|
|
397
|
+
self,
|
|
398
|
+
min_value: Optional[str] = None,
|
|
399
|
+
max_value: Optional[str] = None,
|
|
400
|
+
default_value: Optional[str] = None,
|
|
401
|
+
title: Optional[str] = None,
|
|
402
|
+
**kwargs
|
|
403
|
+
):
|
|
404
|
+
super().__init__(
|
|
405
|
+
min_value=min_value,
|
|
406
|
+
max_value=max_value,
|
|
407
|
+
default_value=default_value,
|
|
408
|
+
title=title,
|
|
409
|
+
**kwargs
|
|
410
|
+
)
|
|
411
|
+
|
|
140
412
|
|
|
141
413
|
class ButtonStringPicker(DataManager):
|
|
142
414
|
items: Optional[list[str]] = None
|
|
143
415
|
default_value: Optional[str] = None
|
|
144
416
|
title: Optional[str] = None
|
|
145
417
|
|
|
418
|
+
def __init__(
|
|
419
|
+
self,
|
|
420
|
+
items: Optional[list[str]] = None,
|
|
421
|
+
default_value: Optional[str] = None,
|
|
422
|
+
title: Optional[str] = None,
|
|
423
|
+
**kwargs
|
|
424
|
+
):
|
|
425
|
+
super().__init__(
|
|
426
|
+
items=items,
|
|
427
|
+
default_value=default_value,
|
|
428
|
+
title=title,
|
|
429
|
+
**kwargs
|
|
430
|
+
)
|
|
431
|
+
|
|
146
432
|
|
|
147
433
|
class ButtonTextbox(DataManager):
|
|
148
434
|
type_line: Optional[enums.ButtonTextboxTypeLine] = None
|
|
@@ -151,6 +437,24 @@ class ButtonTextbox(DataManager):
|
|
|
151
437
|
title: Optional[str] = None
|
|
152
438
|
default_value: Optional[str] = None
|
|
153
439
|
|
|
440
|
+
def __init__(
|
|
441
|
+
self,
|
|
442
|
+
type_line: Optional[enums.ButtonTextboxTypeLine] = None,
|
|
443
|
+
type_keypad: Optional[enums.ButtonTextboxTypeKeypad] = None,
|
|
444
|
+
place_holder: Optional[str] = None,
|
|
445
|
+
title: Optional[str] = None,
|
|
446
|
+
default_value: Optional[str] = None,
|
|
447
|
+
**kwargs
|
|
448
|
+
):
|
|
449
|
+
super().__init__(
|
|
450
|
+
type_line=type_line,
|
|
451
|
+
type_keypad=type_keypad,
|
|
452
|
+
place_holder=place_holder,
|
|
453
|
+
title=title,
|
|
454
|
+
default_value=default_value,
|
|
455
|
+
**kwargs
|
|
456
|
+
)
|
|
457
|
+
|
|
154
458
|
|
|
155
459
|
class ButtonLocation(DataManager):
|
|
156
460
|
default_pointer_location: Optional[Location] = None
|
|
@@ -159,16 +463,58 @@ class ButtonLocation(DataManager):
|
|
|
159
463
|
title: Optional[str] = None
|
|
160
464
|
location_image_url: Optional[str] = None
|
|
161
465
|
|
|
466
|
+
def __init__(
|
|
467
|
+
self,
|
|
468
|
+
default_pointer_location: Optional[Location] = None,
|
|
469
|
+
default_map_location: Optional[Location] = None,
|
|
470
|
+
type: Optional[enums.ButtonLocationType] = None,
|
|
471
|
+
title: Optional[str] = None,
|
|
472
|
+
location_image_url: Optional[str] = None,
|
|
473
|
+
**kwargs
|
|
474
|
+
):
|
|
475
|
+
super().__init__(
|
|
476
|
+
default_pointer_location=default_pointer_location,
|
|
477
|
+
default_map_location=default_map_location,
|
|
478
|
+
type=type,
|
|
479
|
+
title=title,
|
|
480
|
+
location_image_url=location_image_url,
|
|
481
|
+
**kwargs
|
|
482
|
+
)
|
|
483
|
+
|
|
162
484
|
|
|
163
485
|
class OpenChatData(DataManager):
|
|
164
486
|
object_guid: Optional[str] = None
|
|
165
487
|
object_type: Optional[enums.ChatType] = None
|
|
166
488
|
|
|
489
|
+
def __init__(
|
|
490
|
+
self,
|
|
491
|
+
object_guid: Optional[str] = None,
|
|
492
|
+
object_type: Optional[enums.ChatType] = None,
|
|
493
|
+
**kwargs
|
|
494
|
+
):
|
|
495
|
+
super().__init__(
|
|
496
|
+
object_guid=object_guid,
|
|
497
|
+
object_type=object_type,
|
|
498
|
+
**kwargs
|
|
499
|
+
)
|
|
500
|
+
|
|
167
501
|
|
|
168
502
|
class JoinChannelData(DataManager):
|
|
169
503
|
username: Optional[str] = None
|
|
170
504
|
ask_join: bool = False
|
|
171
505
|
|
|
506
|
+
def __init__(
|
|
507
|
+
self,
|
|
508
|
+
username: Optional[str] = None,
|
|
509
|
+
ask_join: bool = False,
|
|
510
|
+
**kwargs
|
|
511
|
+
):
|
|
512
|
+
super().__init__(
|
|
513
|
+
username=username,
|
|
514
|
+
ask_join=ask_join,
|
|
515
|
+
**kwargs
|
|
516
|
+
)
|
|
517
|
+
|
|
172
518
|
|
|
173
519
|
class ButtonLink(DataManager):
|
|
174
520
|
type: Optional[enums.ButtonLinkType] = None
|
|
@@ -176,11 +522,39 @@ class ButtonLink(DataManager):
|
|
|
176
522
|
joinchannel_data: Optional[JoinChannelData] = None
|
|
177
523
|
open_chat_data: Optional[OpenChatData] = None
|
|
178
524
|
|
|
525
|
+
def __init__(
|
|
526
|
+
self,
|
|
527
|
+
type: Optional[enums.ButtonLinkType] = None,
|
|
528
|
+
link_url: Optional[str] = None,
|
|
529
|
+
joinchannel_data: Optional[JoinChannelData] = None,
|
|
530
|
+
open_chat_data: Optional[OpenChatData] = None,
|
|
531
|
+
**kwargs
|
|
532
|
+
):
|
|
533
|
+
super().__init__(
|
|
534
|
+
type=type,
|
|
535
|
+
link_url=link_url,
|
|
536
|
+
joinchannel_data=joinchannel_data,
|
|
537
|
+
open_chat_data=open_chat_data,
|
|
538
|
+
**kwargs
|
|
539
|
+
)
|
|
540
|
+
|
|
179
541
|
|
|
180
542
|
class AuxData(DataManager):
|
|
181
543
|
start_id: Optional[str] = None
|
|
182
544
|
button_id: Optional[str] = None
|
|
183
545
|
|
|
546
|
+
def __init__(
|
|
547
|
+
self,
|
|
548
|
+
start_id: Optional[str] = None,
|
|
549
|
+
button_id: Optional[str] = None,
|
|
550
|
+
**kwargs
|
|
551
|
+
):
|
|
552
|
+
super().__init__(
|
|
553
|
+
start_id=start_id,
|
|
554
|
+
button_id=button_id,
|
|
555
|
+
**kwargs
|
|
556
|
+
)
|
|
557
|
+
|
|
184
558
|
|
|
185
559
|
class Button(DataManager):
|
|
186
560
|
id: Optional[str] = None
|
|
@@ -194,21 +568,85 @@ class Button(DataManager):
|
|
|
194
568
|
button_textbox: Optional[ButtonTextbox] = None
|
|
195
569
|
button_link: Optional[ButtonLink] = None
|
|
196
570
|
|
|
571
|
+
def __init__(
|
|
572
|
+
self,
|
|
573
|
+
id: Optional[str] = None,
|
|
574
|
+
button_text: Optional[str] = None,
|
|
575
|
+
type: enums.ButtonType = enums.ButtonType.Simple,
|
|
576
|
+
button_selection: Optional[ButtonSelection] = None,
|
|
577
|
+
button_calendar: Optional[ButtonCalendar] = None,
|
|
578
|
+
button_number_picker: Optional[ButtonNumberPicker] = None,
|
|
579
|
+
button_string_picker: Optional[ButtonStringPicker] = None,
|
|
580
|
+
button_location: Optional[ButtonLocation] = None,
|
|
581
|
+
button_textbox: Optional[ButtonTextbox] = None,
|
|
582
|
+
button_link: Optional[ButtonLink] = None,
|
|
583
|
+
**kwargs
|
|
584
|
+
):
|
|
585
|
+
super().__init__(
|
|
586
|
+
id=id,
|
|
587
|
+
button_text=button_text,
|
|
588
|
+
type=type,
|
|
589
|
+
button_selection=button_selection,
|
|
590
|
+
button_calendar=button_calendar,
|
|
591
|
+
button_number_picker=button_number_picker,
|
|
592
|
+
button_string_picker=button_string_picker,
|
|
593
|
+
button_location=button_location,
|
|
594
|
+
button_textbox=button_textbox,
|
|
595
|
+
button_link=button_link,
|
|
596
|
+
**kwargs
|
|
597
|
+
)
|
|
598
|
+
|
|
197
599
|
|
|
198
600
|
class KeypadRow(DataManager):
|
|
199
601
|
buttons: list[Button]
|
|
200
602
|
|
|
603
|
+
def __init__(
|
|
604
|
+
self,
|
|
605
|
+
buttons: list[Button],
|
|
606
|
+
**kwargs
|
|
607
|
+
):
|
|
608
|
+
super().__init__(
|
|
609
|
+
buttons=buttons,
|
|
610
|
+
**kwargs
|
|
611
|
+
)
|
|
612
|
+
|
|
201
613
|
|
|
202
614
|
class Keypad(DataManager):
|
|
203
615
|
rows: list[KeypadRow]
|
|
204
616
|
resize_keyboard: bool = True
|
|
205
617
|
on_time_keyboard: bool = False
|
|
206
618
|
|
|
619
|
+
def __init__(
|
|
620
|
+
self,
|
|
621
|
+
rows: list[KeypadRow],
|
|
622
|
+
resize_keyboard: bool = True,
|
|
623
|
+
on_time_keyboard: bool = False,
|
|
624
|
+
**kwargs
|
|
625
|
+
):
|
|
626
|
+
super().__init__(
|
|
627
|
+
rows=rows,
|
|
628
|
+
resize_keyboard=resize_keyboard,
|
|
629
|
+
on_time_keyboard=on_time_keyboard,
|
|
630
|
+
**kwargs
|
|
631
|
+
)
|
|
632
|
+
|
|
207
633
|
|
|
208
634
|
class MessageKeypadUpdate(DataManager):
|
|
209
635
|
message_id: Optional[str] = None
|
|
210
636
|
inline_keypad: Optional[Keypad] = None
|
|
211
637
|
|
|
638
|
+
def __init__(
|
|
639
|
+
self,
|
|
640
|
+
message_id: Optional[str] = None,
|
|
641
|
+
inline_keypad: Optional[Keypad] = None,
|
|
642
|
+
**kwargs
|
|
643
|
+
):
|
|
644
|
+
super().__init__(
|
|
645
|
+
message_id=message_id,
|
|
646
|
+
inline_keypad=inline_keypad,
|
|
647
|
+
**kwargs
|
|
648
|
+
)
|
|
649
|
+
|
|
212
650
|
|
|
213
651
|
class Message(DataManager):
|
|
214
652
|
message_id: Optional[str] = None
|
|
@@ -228,6 +666,46 @@ class Message(DataManager):
|
|
|
228
666
|
poll: Optional[Poll] = None
|
|
229
667
|
live_location: Optional[LiveLocation] = None
|
|
230
668
|
|
|
669
|
+
def __init__(
|
|
670
|
+
self,
|
|
671
|
+
message_id: Optional[str] = None,
|
|
672
|
+
text: Optional[str] = None,
|
|
673
|
+
time: Optional[str] = None,
|
|
674
|
+
is_edited: Optional[bool] = None,
|
|
675
|
+
sender_type: Optional[enums.MessageSender] = None,
|
|
676
|
+
sender_id: Optional[str] = None,
|
|
677
|
+
aux_data: Optional[AuxData] = None,
|
|
678
|
+
file: Optional[File] = None,
|
|
679
|
+
reply_to_message_id: Optional[str] = None,
|
|
680
|
+
forwarded_from: Optional[ForwardedFrom] = None,
|
|
681
|
+
forwarded_no_link: Optional[str] = None,
|
|
682
|
+
location: Optional[Location] = None,
|
|
683
|
+
sticker: Optional[Sticker] = None,
|
|
684
|
+
contact_message: Optional[ContactMessage] = None,
|
|
685
|
+
poll: Optional[Poll] = None,
|
|
686
|
+
live_location: Optional[LiveLocation] = None,
|
|
687
|
+
**kwargs
|
|
688
|
+
):
|
|
689
|
+
super().__init__(
|
|
690
|
+
message_id=message_id,
|
|
691
|
+
text=text,
|
|
692
|
+
time=time,
|
|
693
|
+
is_edited=is_edited,
|
|
694
|
+
sender_type=sender_type,
|
|
695
|
+
sender_id=sender_id,
|
|
696
|
+
aux_data=aux_data,
|
|
697
|
+
file=file,
|
|
698
|
+
reply_to_message_id=reply_to_message_id,
|
|
699
|
+
forwarded_from=forwarded_from,
|
|
700
|
+
forwarded_no_link=forwarded_no_link,
|
|
701
|
+
location=location,
|
|
702
|
+
sticker=sticker,
|
|
703
|
+
contact_message=contact_message,
|
|
704
|
+
poll=poll,
|
|
705
|
+
live_location=live_location,
|
|
706
|
+
**kwargs
|
|
707
|
+
)
|
|
708
|
+
|
|
231
709
|
|
|
232
710
|
class MessageId(DataManager):
|
|
233
711
|
message_id: Optional[str] = None
|
|
@@ -235,14 +713,41 @@ class MessageId(DataManager):
|
|
|
235
713
|
chat_id: Optional[str] = None
|
|
236
714
|
client: Optional[Any] = None
|
|
237
715
|
|
|
716
|
+
def __init__(
|
|
717
|
+
self,
|
|
718
|
+
message_id: Optional[str] = None,
|
|
719
|
+
file_id: Optional[str] = None,
|
|
720
|
+
chat_id: Optional[str] = None,
|
|
721
|
+
client: Optional[Any] = None,
|
|
722
|
+
**kwargs
|
|
723
|
+
):
|
|
724
|
+
super().__init__(
|
|
725
|
+
message_id=message_id,
|
|
726
|
+
file_id=file_id,
|
|
727
|
+
chat_id=chat_id,
|
|
728
|
+
client=client,
|
|
729
|
+
**kwargs
|
|
730
|
+
)
|
|
731
|
+
|
|
238
732
|
async def delete(self):
|
|
239
733
|
return await self.client.delete_message(self.chat_id, self.message_id)
|
|
734
|
+
|
|
735
|
+
async def edit(self, text: Optional[str] = None, inline: Optional[Keypad] = None, keypad: Optional[Keypad] = None):
|
|
736
|
+
if text:
|
|
737
|
+
await self.edit_text(text)
|
|
738
|
+
if inline:
|
|
739
|
+
await self.edit_inline(inline)
|
|
740
|
+
if keypad:
|
|
741
|
+
await self.edit_keypad(keypad)
|
|
240
742
|
|
|
241
743
|
async def edit_text(self, text: str):
|
|
242
744
|
return await self.client.edit_message_text(self.chat_id, self.message_id, text)
|
|
243
745
|
|
|
244
|
-
async def
|
|
245
|
-
return await self.client.edit_message_keypad(self.chat_id, self.message_id,
|
|
746
|
+
async def edit_inline(self, inline: Keypad):
|
|
747
|
+
return await self.client.edit_message_keypad(self.chat_id, self.message_id, inline)
|
|
748
|
+
|
|
749
|
+
async def edit_keypad(self, keypad: Keypad):
|
|
750
|
+
return await self.client.edit_chat_keypad(self.chat_id, keypad)
|
|
246
751
|
|
|
247
752
|
async def forward(self, chat_id: str):
|
|
248
753
|
return await self.client.forward_message(self.chat_id, self.message_id, chat_id)
|
|
@@ -257,6 +762,26 @@ class Update(DataManager):
|
|
|
257
762
|
updated_message: Optional[Message] = None
|
|
258
763
|
updated_payment: Optional[PaymentStatus] = None
|
|
259
764
|
|
|
765
|
+
def __init__(
|
|
766
|
+
self,
|
|
767
|
+
type: Optional[enums.UpdateType] = None,
|
|
768
|
+
chat_id: Optional[str] = None,
|
|
769
|
+
removed_message_id: Optional[str] = None,
|
|
770
|
+
new_message: Optional[Message] = None,
|
|
771
|
+
updated_message: Optional[Message] = None,
|
|
772
|
+
updated_payment: Optional[PaymentStatus] = None,
|
|
773
|
+
**kwargs
|
|
774
|
+
):
|
|
775
|
+
super().__init__(
|
|
776
|
+
type=type,
|
|
777
|
+
chat_id=chat_id,
|
|
778
|
+
removed_message_id=removed_message_id,
|
|
779
|
+
new_message=new_message,
|
|
780
|
+
updated_message=updated_message,
|
|
781
|
+
updated_payment=updated_payment,
|
|
782
|
+
**kwargs
|
|
783
|
+
)
|
|
784
|
+
|
|
260
785
|
async def download(self, file_name: str):
|
|
261
786
|
return await self.client.download_file(self.new_message.file.file_id, file_name)
|
|
262
787
|
|
|
@@ -363,9 +888,9 @@ class Update(DataManager):
|
|
|
363
888
|
|
|
364
889
|
async def reply_file(
|
|
365
890
|
self,
|
|
366
|
-
file: str,
|
|
367
|
-
|
|
368
|
-
|
|
891
|
+
file: Union[str, bytes],
|
|
892
|
+
caption: Optional[str] = None,
|
|
893
|
+
file_name: Optional[str] = None,
|
|
369
894
|
type: enums.FileType = enums.FileType.File,
|
|
370
895
|
chat_keypad: Keypad = None,
|
|
371
896
|
inline_keypad: Keypad = None,
|
|
@@ -375,8 +900,8 @@ class Update(DataManager):
|
|
|
375
900
|
return await self.client.send_file(
|
|
376
901
|
self.chat_id,
|
|
377
902
|
file,
|
|
378
|
-
file_name,
|
|
379
903
|
caption,
|
|
904
|
+
file_name,
|
|
380
905
|
type,
|
|
381
906
|
chat_keypad,
|
|
382
907
|
inline_keypad,
|
|
@@ -385,28 +910,23 @@ class Update(DataManager):
|
|
|
385
910
|
self.new_message.message_id,
|
|
386
911
|
)
|
|
387
912
|
|
|
388
|
-
async def reply_document(self, document: str,
|
|
389
|
-
return await self.reply_file(document,
|
|
913
|
+
async def reply_document(self, document: Union[str, bytes], caption: Optional[str] = None, file_name: Optional[str] = None, **kwargs) -> "MessageId":
|
|
914
|
+
return await self.reply_file(document, caption, file_name, "File", **kwargs)
|
|
390
915
|
|
|
391
|
-
async def reply_photo(self, photo: str,
|
|
392
|
-
return await self.reply_file(photo,
|
|
916
|
+
async def reply_photo(self, photo: Union[str, bytes], caption: Optional[str] = None, file_name: Optional[str] = None, **kwargs) -> "MessageId":
|
|
917
|
+
return await self.reply_file(photo, caption, file_name, "Image", **kwargs)
|
|
393
918
|
|
|
394
|
-
async def reply_video(self, video: str,
|
|
395
|
-
return await self.reply_file(video,
|
|
919
|
+
async def reply_video(self, video: Union[str, bytes], caption: Optional[str] = None, file_name: Optional[str] = None, **kwargs) -> "MessageId":
|
|
920
|
+
return await self.reply_file(video, caption, file_name, "Video", **kwargs)
|
|
396
921
|
|
|
397
|
-
async def reply_gif(self, gif: str,
|
|
398
|
-
return await self.reply_file(gif,
|
|
922
|
+
async def reply_gif(self, gif: Union[str, bytes], caption: Optional[str] = None, file_name: Optional[str] = None, **kwargs) -> "MessageId":
|
|
923
|
+
return await self.reply_file(gif, caption, file_name, "Gif", **kwargs)
|
|
399
924
|
|
|
400
|
-
async def reply_music(self, music: str,
|
|
401
|
-
return await self.reply_file(music,
|
|
925
|
+
async def reply_music(self, music: Union[str, bytes], caption: Optional[str] = None, file_name: Optional[str] = None, **kwargs) -> "MessageId":
|
|
926
|
+
return await self.reply_file(music, caption, file_name, "Music", **kwargs)
|
|
402
927
|
|
|
403
|
-
async def reply_voice(self, voice: str,
|
|
404
|
-
return await self.reply_file(voice,
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
class Updates(DataManager):
|
|
408
|
-
updates: Optional[list[Update]] = None
|
|
409
|
-
next_offset_id: Optional[str] = None
|
|
928
|
+
async def reply_voice(self, voice: Union[str, bytes], caption: Optional[str] = None, file_name: Optional[str] = None, **kwargs) -> "MessageId":
|
|
929
|
+
return await self.reply_file(voice, caption, file_name, "Voice", **kwargs)
|
|
410
930
|
|
|
411
931
|
|
|
412
932
|
class InlineMessage(DataManager):
|
|
@@ -417,4 +937,43 @@ class InlineMessage(DataManager):
|
|
|
417
937
|
chat_id: Optional[str] = None
|
|
418
938
|
file: Optional[File] = None
|
|
419
939
|
location: Optional[Location] = None
|
|
420
|
-
aux_data: Optional[AuxData] = None
|
|
940
|
+
aux_data: Optional[AuxData] = None
|
|
941
|
+
|
|
942
|
+
def __init__(
|
|
943
|
+
self,
|
|
944
|
+
sender_id: Optional[str] = None,
|
|
945
|
+
text: Optional[str] = None,
|
|
946
|
+
message_id: Optional[str] = None,
|
|
947
|
+
chat_id: Optional[str] = None,
|
|
948
|
+
file: Optional[File] = None,
|
|
949
|
+
location: Optional[Location] = None,
|
|
950
|
+
aux_data: Optional[AuxData] = None,
|
|
951
|
+
**kwargs
|
|
952
|
+
):
|
|
953
|
+
super().__init__(
|
|
954
|
+
sender_id=sender_id,
|
|
955
|
+
text=text,
|
|
956
|
+
message_id=message_id,
|
|
957
|
+
chat_id=chat_id,
|
|
958
|
+
file=file,
|
|
959
|
+
location=location,
|
|
960
|
+
aux_data=aux_data,
|
|
961
|
+
**kwargs
|
|
962
|
+
)
|
|
963
|
+
|
|
964
|
+
|
|
965
|
+
class Updates(DataManager):
|
|
966
|
+
updates: Optional[list[Update]] = None
|
|
967
|
+
next_offset_id: Optional[str] = None
|
|
968
|
+
|
|
969
|
+
def __init__(
|
|
970
|
+
self,
|
|
971
|
+
updates: Optional[list[Update]] = None,
|
|
972
|
+
next_offset_id: Optional[str] = None,
|
|
973
|
+
**kwargs
|
|
974
|
+
):
|
|
975
|
+
super().__init__(
|
|
976
|
+
updates=updates,
|
|
977
|
+
next_offset_id=next_offset_id,
|
|
978
|
+
**kwargs
|
|
979
|
+
)
|