botapi-py 1.5.8__tar.gz → 1.5.9__tar.gz
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.
- {botapi_py-1.5.8 → botapi_py-1.5.9}/PKG-INFO +1 -1
- {botapi_py-1.5.8 → botapi_py-1.5.9}/pyproject.toml +1 -1
- {botapi_py-1.5.8 → botapi_py-1.5.9}/src/botapi/enums.py +3 -0
- {botapi_py-1.5.8 → botapi_py-1.5.9}/src/botapi/methods.py +236 -32
- {botapi_py-1.5.8 → botapi_py-1.5.9}/src/botapi/types.py +328 -110
- {botapi_py-1.5.8 → botapi_py-1.5.9}/src/botapi/__init__.py +0 -0
- {botapi_py-1.5.8 → botapi_py-1.5.9}/src/botapi/__init__.pyi +0 -0
- {botapi_py-1.5.8 → botapi_py-1.5.9}/src/botapi/bot.py +0 -0
- {botapi_py-1.5.8 → botapi_py-1.5.9}/src/botapi/core.py +0 -0
- {botapi_py-1.5.8 → botapi_py-1.5.9}/src/botapi/dispatchers/__init__.py +0 -0
- {botapi_py-1.5.8 → botapi_py-1.5.9}/src/botapi/dispatchers/__init__.pyi +0 -0
- {botapi_py-1.5.8 → botapi_py-1.5.9}/src/botapi/dispatchers/common.py +0 -0
- {botapi_py-1.5.8 → botapi_py-1.5.9}/src/botapi/dispatchers/get_updates_handler.py +0 -0
- {botapi_py-1.5.8 → botapi_py-1.5.9}/src/botapi/dispatchers/redis_pubsub_handler.py +0 -0
- {botapi_py-1.5.8 → botapi_py-1.5.9}/src/botapi/errors.py +0 -0
- {botapi_py-1.5.8 → botapi_py-1.5.9}/src/botapi/internals.py +0 -0
|
@@ -42,6 +42,8 @@ class UpdateType(enum.StrEnum):
|
|
|
42
42
|
EDITED_BUSINESS_MESSAGE = 'edited_business_message'
|
|
43
43
|
DELETED_BUSINESS_MESSAGES = 'deleted_business_messages'
|
|
44
44
|
PURCHASED_PAID_MEDIA = 'purchased_paid_media'
|
|
45
|
+
MANAGED_BOT = 'managed_bot'
|
|
46
|
+
GUEST_MESSAGE = 'guest_message'
|
|
45
47
|
|
|
46
48
|
class MediaType(enum.StrEnum):
|
|
47
49
|
'''
|
|
@@ -59,6 +61,7 @@ class MediaType(enum.StrEnum):
|
|
|
59
61
|
VOICE = 'voice'
|
|
60
62
|
STORY = 'story' # does not have `file_id`, only `id`
|
|
61
63
|
PAID_MEDIA = 'paid_media' # this contains a `photo` attribute that is a list of `PhotoSize` objects
|
|
64
|
+
LIVE_PHOTO = 'live_photo'
|
|
62
65
|
|
|
63
66
|
class ServiceMessage(enum.StrEnum):
|
|
64
67
|
'''
|
|
@@ -37,6 +37,7 @@ from .types import (
|
|
|
37
37
|
Animation,
|
|
38
38
|
Audio,
|
|
39
39
|
Document,
|
|
40
|
+
LivePhoto,
|
|
40
41
|
Story,
|
|
41
42
|
VideoQuality,
|
|
42
43
|
Video,
|
|
@@ -46,11 +47,19 @@ from .types import (
|
|
|
46
47
|
PaidMedia,
|
|
47
48
|
_PaidMedia,
|
|
48
49
|
PaidMediaAdapter,
|
|
49
|
-
|
|
50
|
+
PaidMediaLivePhoto,
|
|
50
51
|
PaidMediaPhoto,
|
|
52
|
+
PaidMediaPreview,
|
|
51
53
|
PaidMediaVideo,
|
|
52
54
|
Contact,
|
|
53
55
|
Dice,
|
|
56
|
+
PollMedia,
|
|
57
|
+
InputPollMedia,
|
|
58
|
+
_InputPollMedia,
|
|
59
|
+
InputPollMediaAdapter,
|
|
60
|
+
InputPollOptionMedia,
|
|
61
|
+
_InputPollOptionMedia,
|
|
62
|
+
InputPollOptionMediaAdapter,
|
|
54
63
|
PollOption,
|
|
55
64
|
InputPollOption,
|
|
56
65
|
PollAnswer,
|
|
@@ -193,6 +202,7 @@ from .types import (
|
|
|
193
202
|
OwnedGiftRegular,
|
|
194
203
|
OwnedGiftUnique,
|
|
195
204
|
OwnedGifts,
|
|
205
|
+
BotAccessSettings,
|
|
196
206
|
AcceptedGiftTypes,
|
|
197
207
|
StarAmount,
|
|
198
208
|
BotCommand,
|
|
@@ -231,21 +241,27 @@ from .types import (
|
|
|
231
241
|
BusinessConnection,
|
|
232
242
|
BusinessMessagesDeleted,
|
|
233
243
|
SentWebAppMessage,
|
|
244
|
+
SentGuestMessage,
|
|
234
245
|
PreparedInlineMessage,
|
|
235
246
|
PreparedKeyboardButton,
|
|
236
247
|
ResponseParameters,
|
|
237
248
|
InputMedia,
|
|
238
249
|
_InputMedia,
|
|
239
250
|
InputMediaAdapter,
|
|
240
|
-
InputMediaPhoto,
|
|
241
|
-
InputMediaVideo,
|
|
242
251
|
InputMediaAnimation,
|
|
243
252
|
InputMediaAudio,
|
|
244
253
|
InputMediaDocument,
|
|
254
|
+
InputMediaLivePhoto,
|
|
255
|
+
InputMediaLocation,
|
|
256
|
+
InputMediaPhoto,
|
|
257
|
+
InputMediaSticker,
|
|
258
|
+
InputMediaVenue,
|
|
259
|
+
InputMediaVideo,
|
|
245
260
|
InputFile,
|
|
246
261
|
InputPaidMedia,
|
|
247
262
|
_InputPaidMedia,
|
|
248
263
|
InputPaidMediaAdapter,
|
|
264
|
+
InputPaidMediaLivePhoto,
|
|
249
265
|
InputPaidMediaPhoto,
|
|
250
266
|
InputPaidMediaVideo,
|
|
251
267
|
InputProfilePhoto,
|
|
@@ -753,6 +769,56 @@ class Methods(core.BaseBot):
|
|
|
753
769
|
})
|
|
754
770
|
return Message.model_validate(response)
|
|
755
771
|
|
|
772
|
+
async def send_live_photo(
|
|
773
|
+
self,
|
|
774
|
+
chat_id: Union[int, str],
|
|
775
|
+
live_photo: Union[InputFile, str],
|
|
776
|
+
photo: Union[InputFile, str],
|
|
777
|
+
business_connection_id: Optional[str] = None,
|
|
778
|
+
message_thread_id: Optional[int] = None,
|
|
779
|
+
direct_messages_topic_id: Optional[int] = None,
|
|
780
|
+
caption: Optional[str] = None,
|
|
781
|
+
parse_mode: Optional[Union[str, enums.ParseMode]] = None,
|
|
782
|
+
caption_entities: Optional[List[MessageEntity]] = None,
|
|
783
|
+
show_caption_above_media: Optional[bool] = None,
|
|
784
|
+
has_spoiler: Optional[bool] = None,
|
|
785
|
+
disable_notification: Optional[bool] = None,
|
|
786
|
+
protect_content: Optional[bool] = None,
|
|
787
|
+
allow_paid_broadcast: Optional[bool] = None,
|
|
788
|
+
message_effect_id: Optional[str] = None,
|
|
789
|
+
suggested_post_parameters: Optional[SuggestedPostParameters] = None,
|
|
790
|
+
reply_parameters: Optional[ReplyParameters] = None,
|
|
791
|
+
reply_markup: Optional[Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]] = None,
|
|
792
|
+
) -> Message:
|
|
793
|
+
'''
|
|
794
|
+
Use this method to send live photos. On
|
|
795
|
+
success, the sent Message is returned.
|
|
796
|
+
|
|
797
|
+
Reference: https://core.telegram.org/bots/api#sendlivephoto
|
|
798
|
+
'''
|
|
799
|
+
|
|
800
|
+
response = await self._send_request('sendLivePhoto', {
|
|
801
|
+
'business_connection_id': business_connection_id,
|
|
802
|
+
'chat_id': chat_id,
|
|
803
|
+
'message_thread_id': message_thread_id,
|
|
804
|
+
'direct_messages_topic_id': direct_messages_topic_id,
|
|
805
|
+
'live_photo': live_photo,
|
|
806
|
+
'photo': photo,
|
|
807
|
+
'caption': caption,
|
|
808
|
+
'parse_mode': parse_mode,
|
|
809
|
+
'caption_entities': caption_entities,
|
|
810
|
+
'show_caption_above_media': show_caption_above_media,
|
|
811
|
+
'has_spoiler': has_spoiler,
|
|
812
|
+
'disable_notification': disable_notification,
|
|
813
|
+
'protect_content': protect_content,
|
|
814
|
+
'allow_paid_broadcast': allow_paid_broadcast,
|
|
815
|
+
'message_effect_id': message_effect_id,
|
|
816
|
+
'suggested_post_parameters': suggested_post_parameters,
|
|
817
|
+
'reply_parameters': reply_parameters,
|
|
818
|
+
'reply_markup': reply_markup,
|
|
819
|
+
})
|
|
820
|
+
return Message.model_validate(response)
|
|
821
|
+
|
|
756
822
|
async def send_audio(
|
|
757
823
|
self,
|
|
758
824
|
chat_id: Union[int, str],
|
|
@@ -1140,7 +1206,7 @@ class Methods(core.BaseBot):
|
|
|
1140
1206
|
async def send_media_group(
|
|
1141
1207
|
self,
|
|
1142
1208
|
chat_id: Union[int, str],
|
|
1143
|
-
media: List[Union[InputMediaAudio, InputMediaDocument, InputMediaPhoto, InputMediaVideo]],
|
|
1209
|
+
media: List[Union[InputMediaAudio, InputMediaDocument, InputMediaLivePhoto, InputMediaPhoto, InputMediaVideo]],
|
|
1144
1210
|
business_connection_id: Optional[str] = None,
|
|
1145
1211
|
message_thread_id: Optional[int] = None,
|
|
1146
1212
|
direct_messages_topic_id: Optional[int] = None,
|
|
@@ -1152,11 +1218,11 @@ class Methods(core.BaseBot):
|
|
|
1152
1218
|
) -> List[Message]:
|
|
1153
1219
|
'''
|
|
1154
1220
|
Use this method to send a group of
|
|
1155
|
-
photos, videos, documents or audios as
|
|
1156
|
-
Documents and audio files can be
|
|
1157
|
-
in an album with messages of
|
|
1158
|
-
type. On success, an array of
|
|
1159
|
-
that were sent is returned.
|
|
1221
|
+
photos, live photos, videos, documents or audios as
|
|
1222
|
+
an album. Documents and audio files can be
|
|
1223
|
+
only grouped in an album with messages of
|
|
1224
|
+
the same type. On success, an array of
|
|
1225
|
+
Message objects that were sent is returned.
|
|
1160
1226
|
|
|
1161
1227
|
Reference: https://core.telegram.org/bots/api#sendmediagroup
|
|
1162
1228
|
'''
|
|
@@ -1335,16 +1401,20 @@ class Methods(core.BaseBot):
|
|
|
1335
1401
|
shuffle_options: Optional[bool] = None,
|
|
1336
1402
|
allow_adding_options: Optional[bool] = None,
|
|
1337
1403
|
hide_results_until_closes: Optional[bool] = None,
|
|
1404
|
+
members_only: Optional[bool] = None,
|
|
1405
|
+
country_codes: Optional[List[str]] = None,
|
|
1338
1406
|
correct_option_ids: Optional[List[int]] = None,
|
|
1339
1407
|
explanation: Optional[str] = None,
|
|
1340
1408
|
explanation_parse_mode: Optional[str] = None,
|
|
1341
1409
|
explanation_entities: Optional[List[MessageEntity]] = None,
|
|
1410
|
+
explanation_media: Optional[_InputPollMedia] = None,
|
|
1342
1411
|
open_period: Optional[int] = None,
|
|
1343
1412
|
close_date: Optional[int] = None,
|
|
1344
1413
|
is_closed: Optional[bool] = None,
|
|
1345
1414
|
description: Optional[str] = None,
|
|
1346
1415
|
description_parse_mode: Optional[str] = None,
|
|
1347
1416
|
description_entities: Optional[List[MessageEntity]] = None,
|
|
1417
|
+
media: Optional[_InputPollMedia] = None,
|
|
1348
1418
|
disable_notification: Optional[bool] = None,
|
|
1349
1419
|
protect_content: Optional[bool] = None,
|
|
1350
1420
|
allow_paid_broadcast: Optional[bool] = None,
|
|
@@ -1374,16 +1444,20 @@ class Methods(core.BaseBot):
|
|
|
1374
1444
|
'shuffle_options': shuffle_options,
|
|
1375
1445
|
'allow_adding_options': allow_adding_options,
|
|
1376
1446
|
'hide_results_until_closes': hide_results_until_closes,
|
|
1447
|
+
'members_only': members_only,
|
|
1448
|
+
'country_codes': country_codes,
|
|
1377
1449
|
'correct_option_ids': correct_option_ids,
|
|
1378
1450
|
'explanation': explanation,
|
|
1379
1451
|
'explanation_parse_mode': explanation_parse_mode,
|
|
1380
1452
|
'explanation_entities': explanation_entities,
|
|
1453
|
+
'explanation_media': explanation_media,
|
|
1381
1454
|
'open_period': open_period,
|
|
1382
1455
|
'close_date': close_date,
|
|
1383
1456
|
'is_closed': is_closed,
|
|
1384
1457
|
'description': description,
|
|
1385
1458
|
'description_parse_mode': description_parse_mode,
|
|
1386
1459
|
'description_entities': description_entities,
|
|
1460
|
+
'media': media,
|
|
1387
1461
|
'disable_notification': disable_notification,
|
|
1388
1462
|
'protect_content': protect_content,
|
|
1389
1463
|
'allow_paid_broadcast': allow_paid_broadcast,
|
|
@@ -1396,7 +1470,7 @@ class Methods(core.BaseBot):
|
|
|
1396
1470
|
async def send_checklist(
|
|
1397
1471
|
self,
|
|
1398
1472
|
business_connection_id: str,
|
|
1399
|
-
chat_id: int,
|
|
1473
|
+
chat_id: Union[int, str],
|
|
1400
1474
|
checklist: InputChecklist,
|
|
1401
1475
|
disable_notification: Optional[bool] = None,
|
|
1402
1476
|
protect_content: Optional[bool] = None,
|
|
@@ -1467,15 +1541,19 @@ class Methods(core.BaseBot):
|
|
|
1467
1541
|
self,
|
|
1468
1542
|
chat_id: int,
|
|
1469
1543
|
draft_id: int,
|
|
1470
|
-
text: str,
|
|
1471
1544
|
message_thread_id: Optional[int] = None,
|
|
1545
|
+
text: Optional[str] = None,
|
|
1472
1546
|
parse_mode: Optional[Union[str, enums.ParseMode]] = None,
|
|
1473
1547
|
entities: Optional[List[MessageEntity]] = None,
|
|
1474
1548
|
) -> bool:
|
|
1475
1549
|
'''
|
|
1476
1550
|
Use this method to stream a partial message
|
|
1477
1551
|
to a user while the message is being
|
|
1478
|
-
generated.
|
|
1552
|
+
generated. Note that the streamed draft is ephemeral
|
|
1553
|
+
and acts as a temporary 30-second preview -
|
|
1554
|
+
once the output is finalized, you must call
|
|
1555
|
+
sendMessage with the complete message to persist it
|
|
1556
|
+
in the user's chat. Returns True on success.
|
|
1479
1557
|
|
|
1480
1558
|
Reference: https://core.telegram.org/bots/api#sendmessagedraft
|
|
1481
1559
|
'''
|
|
@@ -2277,17 +2355,19 @@ class Methods(core.BaseBot):
|
|
|
2277
2355
|
async def get_chat_administrators(
|
|
2278
2356
|
self,
|
|
2279
2357
|
chat_id: Union[int, str],
|
|
2358
|
+
return_bots: Optional[bool] = None,
|
|
2280
2359
|
) -> List[_ChatMember]:
|
|
2281
2360
|
'''
|
|
2282
2361
|
Use this method to get a list of
|
|
2283
|
-
administrators in a chat
|
|
2284
|
-
|
|
2362
|
+
administrators in a chat. Returns an Array of
|
|
2363
|
+
ChatMember objects.
|
|
2285
2364
|
|
|
2286
2365
|
Reference: https://core.telegram.org/bots/api#getchatadministrators
|
|
2287
2366
|
'''
|
|
2288
2367
|
|
|
2289
2368
|
response = await self._send_request('getChatAdministrators', {
|
|
2290
2369
|
'chat_id': chat_id,
|
|
2370
|
+
'return_bots': return_bots,
|
|
2291
2371
|
})
|
|
2292
2372
|
return [ChatMemberAdapter.validate_python(x) for x in response]
|
|
2293
2373
|
|
|
@@ -2328,6 +2408,27 @@ class Methods(core.BaseBot):
|
|
|
2328
2408
|
})
|
|
2329
2409
|
return ChatMemberAdapter.validate_python(response)
|
|
2330
2410
|
|
|
2411
|
+
async def get_user_personal_chat_messages(
|
|
2412
|
+
self,
|
|
2413
|
+
user_id: int,
|
|
2414
|
+
limit: int,
|
|
2415
|
+
) -> List[Message]:
|
|
2416
|
+
'''
|
|
2417
|
+
Use this method to get the last messages
|
|
2418
|
+
from the personal chat (i.e., the chat currently
|
|
2419
|
+
added to their profile) of a given user.
|
|
2420
|
+
On success, an array of Message objects is
|
|
2421
|
+
returned.
|
|
2422
|
+
|
|
2423
|
+
Reference: https://core.telegram.org/bots/api#getuserpersonalchatmessages
|
|
2424
|
+
'''
|
|
2425
|
+
|
|
2426
|
+
response = await self._send_request('getUserPersonalChatMessages', {
|
|
2427
|
+
'user_id': user_id,
|
|
2428
|
+
'limit': limit,
|
|
2429
|
+
})
|
|
2430
|
+
return [Message.model_validate(x) for x in response]
|
|
2431
|
+
|
|
2331
2432
|
async def set_chat_sticker_set(
|
|
2332
2433
|
self,
|
|
2333
2434
|
chat_id: Union[int, str],
|
|
@@ -2679,6 +2780,25 @@ class Methods(core.BaseBot):
|
|
|
2679
2780
|
})
|
|
2680
2781
|
return BoolAdapter.validate_python(response)
|
|
2681
2782
|
|
|
2783
|
+
async def answer_guest_query(
|
|
2784
|
+
self,
|
|
2785
|
+
guest_query_id: str,
|
|
2786
|
+
result: _InlineQueryResult,
|
|
2787
|
+
) -> SentGuestMessage:
|
|
2788
|
+
'''
|
|
2789
|
+
Use this method to reply to a received
|
|
2790
|
+
guest message. On success, a SentGuestMessage object is
|
|
2791
|
+
returned.
|
|
2792
|
+
|
|
2793
|
+
Reference: https://core.telegram.org/bots/api#answerguestquery
|
|
2794
|
+
'''
|
|
2795
|
+
|
|
2796
|
+
response = await self._send_request('answerGuestQuery', {
|
|
2797
|
+
'guest_query_id': guest_query_id,
|
|
2798
|
+
'result': result,
|
|
2799
|
+
})
|
|
2800
|
+
return SentGuestMessage.model_validate(response)
|
|
2801
|
+
|
|
2682
2802
|
async def get_user_chat_boosts(
|
|
2683
2803
|
self,
|
|
2684
2804
|
chat_id: Union[int, str],
|
|
@@ -2751,6 +2871,43 @@ class Methods(core.BaseBot):
|
|
|
2751
2871
|
})
|
|
2752
2872
|
return StrAdapter.validate_python(response)
|
|
2753
2873
|
|
|
2874
|
+
async def get_managed_bot_access_settings(
|
|
2875
|
+
self,
|
|
2876
|
+
user_id: int,
|
|
2877
|
+
) -> BotAccessSettings:
|
|
2878
|
+
'''
|
|
2879
|
+
Use this method to get the access settings
|
|
2880
|
+
of a managed bot. Returns a BotAccessSettings object
|
|
2881
|
+
on success.
|
|
2882
|
+
|
|
2883
|
+
Reference: https://core.telegram.org/bots/api#getmanagedbotaccesssettings
|
|
2884
|
+
'''
|
|
2885
|
+
|
|
2886
|
+
response = await self._send_request('getManagedBotAccessSettings', {
|
|
2887
|
+
'user_id': user_id,
|
|
2888
|
+
})
|
|
2889
|
+
return BotAccessSettings.model_validate(response)
|
|
2890
|
+
|
|
2891
|
+
async def set_managed_bot_access_settings(
|
|
2892
|
+
self,
|
|
2893
|
+
user_id: int,
|
|
2894
|
+
is_access_restricted: bool,
|
|
2895
|
+
added_user_ids: Optional[List[int]] = None,
|
|
2896
|
+
) -> bool:
|
|
2897
|
+
'''
|
|
2898
|
+
Use this method to change the access settings
|
|
2899
|
+
of a managed bot. Returns True on success.
|
|
2900
|
+
|
|
2901
|
+
Reference: https://core.telegram.org/bots/api#setmanagedbotaccesssettings
|
|
2902
|
+
'''
|
|
2903
|
+
|
|
2904
|
+
response = await self._send_request('setManagedBotAccessSettings', {
|
|
2905
|
+
'user_id': user_id,
|
|
2906
|
+
'is_access_restricted': is_access_restricted,
|
|
2907
|
+
'added_user_ids': added_user_ids,
|
|
2908
|
+
})
|
|
2909
|
+
return BoolAdapter.validate_python(response)
|
|
2910
|
+
|
|
2754
2911
|
async def set_my_commands(
|
|
2755
2912
|
self,
|
|
2756
2913
|
commands: List[BotCommand],
|
|
@@ -3815,22 +3972,22 @@ class Methods(core.BaseBot):
|
|
|
3815
3972
|
) -> Union[Message, bool]:
|
|
3816
3973
|
'''
|
|
3817
3974
|
Use this method to edit animation, audio, document,
|
|
3818
|
-
photo, or video messages, or to
|
|
3819
|
-
to text messages. If a message
|
|
3820
|
-
of a message album, then it
|
|
3821
|
-
edited only to an audio for
|
|
3822
|
-
only to a document for document
|
|
3823
|
-
to a photo
|
|
3824
|
-
|
|
3825
|
-
can't be uploaded;
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
|
|
3832
|
-
|
|
3833
|
-
were sent.
|
|
3975
|
+
live photo, photo, or video messages, or to
|
|
3976
|
+
add media to text messages. If a message
|
|
3977
|
+
is part of a message album, then it
|
|
3978
|
+
can be edited only to an audio for
|
|
3979
|
+
audio albums, only to a document for document
|
|
3980
|
+
albums and to a photo, a live photo,
|
|
3981
|
+
or a video otherwise. When an inline message
|
|
3982
|
+
is edited, a new file can't be uploaded;
|
|
3983
|
+
use a previously uploaded file via its file_id
|
|
3984
|
+
or specify a URL. On success, if the
|
|
3985
|
+
edited message is not an inline message, the
|
|
3986
|
+
edited Message is returned, otherwise True is returned.
|
|
3987
|
+
Note that business messages that were not sent
|
|
3988
|
+
by the bot and do not contain an
|
|
3989
|
+
inline keyboard can only be edited within 48
|
|
3990
|
+
hours from the time they were sent.
|
|
3834
3991
|
|
|
3835
3992
|
Reference: https://core.telegram.org/bots/api#editmessagemedia
|
|
3836
3993
|
'''
|
|
@@ -3923,7 +4080,7 @@ class Methods(core.BaseBot):
|
|
|
3923
4080
|
async def edit_message_checklist(
|
|
3924
4081
|
self,
|
|
3925
4082
|
business_connection_id: str,
|
|
3926
|
-
chat_id: int,
|
|
4083
|
+
chat_id: Union[int, str],
|
|
3927
4084
|
message_id: int,
|
|
3928
4085
|
checklist: InputChecklist,
|
|
3929
4086
|
reply_markup: Optional[InlineKeyboardMarkup] = None,
|
|
@@ -4099,6 +4256,53 @@ class Methods(core.BaseBot):
|
|
|
4099
4256
|
})
|
|
4100
4257
|
return BoolAdapter.validate_python(response)
|
|
4101
4258
|
|
|
4259
|
+
async def delete_message_reaction(
|
|
4260
|
+
self,
|
|
4261
|
+
chat_id: Union[int, str],
|
|
4262
|
+
message_id: int,
|
|
4263
|
+
user_id: Optional[int] = None,
|
|
4264
|
+
actor_chat_id: Optional[int] = None,
|
|
4265
|
+
) -> bool:
|
|
4266
|
+
'''
|
|
4267
|
+
Use this method to remove a reaction from
|
|
4268
|
+
a message in a group or a supergroup
|
|
4269
|
+
chat. The bot must have the 'can_delete_messages' administrator
|
|
4270
|
+
right in the chat. Returns True on success.
|
|
4271
|
+
|
|
4272
|
+
Reference: https://core.telegram.org/bots/api#deletemessagereaction
|
|
4273
|
+
'''
|
|
4274
|
+
|
|
4275
|
+
response = await self._send_request('deleteMessageReaction', {
|
|
4276
|
+
'chat_id': chat_id,
|
|
4277
|
+
'message_id': message_id,
|
|
4278
|
+
'user_id': user_id,
|
|
4279
|
+
'actor_chat_id': actor_chat_id,
|
|
4280
|
+
})
|
|
4281
|
+
return BoolAdapter.validate_python(response)
|
|
4282
|
+
|
|
4283
|
+
async def delete_all_message_reactions(
|
|
4284
|
+
self,
|
|
4285
|
+
chat_id: Union[int, str],
|
|
4286
|
+
user_id: Optional[int] = None,
|
|
4287
|
+
actor_chat_id: Optional[int] = None,
|
|
4288
|
+
) -> bool:
|
|
4289
|
+
'''
|
|
4290
|
+
Use this method to remove up to 10000
|
|
4291
|
+
recent reactions in a group or a supergroup
|
|
4292
|
+
chat added by a given user or chat.
|
|
4293
|
+
The bot must have the 'can_delete_messages' administrator right
|
|
4294
|
+
in the chat. Returns True on success.
|
|
4295
|
+
|
|
4296
|
+
Reference: https://core.telegram.org/bots/api#deleteallmessagereactions
|
|
4297
|
+
'''
|
|
4298
|
+
|
|
4299
|
+
response = await self._send_request('deleteAllMessageReactions', {
|
|
4300
|
+
'chat_id': chat_id,
|
|
4301
|
+
'user_id': user_id,
|
|
4302
|
+
'actor_chat_id': actor_chat_id,
|
|
4303
|
+
})
|
|
4304
|
+
return BoolAdapter.validate_python(response)
|
|
4305
|
+
|
|
4102
4306
|
async def send_sticker(
|
|
4103
4307
|
self,
|
|
4104
4308
|
chat_id: Union[int, str],
|
|
@@ -4756,7 +4960,7 @@ class Methods(core.BaseBot):
|
|
|
4756
4960
|
|
|
4757
4961
|
async def send_game(
|
|
4758
4962
|
self,
|
|
4759
|
-
chat_id: int,
|
|
4963
|
+
chat_id: Union[int, str],
|
|
4760
4964
|
game_short_name: str,
|
|
4761
4965
|
business_connection_id: Optional[str] = None,
|
|
4762
4966
|
message_thread_id: Optional[int] = None,
|
|
@@ -37,6 +37,7 @@ class Message(MaybeInaccessibleMessage):
|
|
|
37
37
|
sender_boost_count: Optional[int] = Field(default=None)
|
|
38
38
|
sender_business_bot: Optional[User] = Field(default=None)
|
|
39
39
|
sender_tag: Optional[str] = Field(default=None)
|
|
40
|
+
guest_query_id: Optional[str] = Field(default=None)
|
|
40
41
|
business_connection_id: Optional[str] = Field(default=None)
|
|
41
42
|
forward_origin: Optional[_MessageOrigin] = Field(default=None)
|
|
42
43
|
is_topic_message: Optional[bool] = Field(default=None)
|
|
@@ -48,6 +49,8 @@ class Message(MaybeInaccessibleMessage):
|
|
|
48
49
|
reply_to_checklist_task_id: Optional[int] = Field(default=None)
|
|
49
50
|
reply_to_poll_option_id: Optional[str] = Field(default=None)
|
|
50
51
|
via_bot: Optional[User] = Field(default=None)
|
|
52
|
+
guest_bot_caller_user: Optional[User] = Field(default=None)
|
|
53
|
+
guest_bot_caller_chat: Optional[Chat] = Field(default=None)
|
|
51
54
|
edit_date: Optional[int] = Field(default=None)
|
|
52
55
|
has_protected_content: Optional[bool] = Field(default=None)
|
|
53
56
|
is_from_offline: Optional[bool] = Field(default=None)
|
|
@@ -63,6 +66,7 @@ class Message(MaybeInaccessibleMessage):
|
|
|
63
66
|
animation: Optional[Animation] = Field(default=None)
|
|
64
67
|
audio: Optional[Audio] = Field(default=None)
|
|
65
68
|
document: Optional[Document] = Field(default=None)
|
|
69
|
+
live_photo: Optional[LivePhoto] = Field(default=None)
|
|
66
70
|
paid_media: Optional[PaidMediaInfo] = Field(default=None)
|
|
67
71
|
photo: Optional[List[PhotoSize]] = Field(default=None)
|
|
68
72
|
sticker: Optional[Sticker] = Field(default=None)
|
|
@@ -487,19 +491,17 @@ _MessageOrigin = Union[
|
|
|
487
491
|
MessageOriginAdapter = TypeAdapter[_MessageOrigin](_MessageOrigin)
|
|
488
492
|
|
|
489
493
|
class PaidMedia(BaseModel):
|
|
490
|
-
type: Literal['
|
|
494
|
+
type: Literal['live_photo', 'photo', 'preview', 'video']
|
|
491
495
|
|
|
492
|
-
class
|
|
496
|
+
class PaidMediaLivePhoto(PaidMedia):
|
|
493
497
|
'''
|
|
494
|
-
The paid media
|
|
498
|
+
The paid media is a live photo.
|
|
495
499
|
|
|
496
|
-
Reference: https://core.telegram.org/bots/api#
|
|
500
|
+
Reference: https://core.telegram.org/bots/api#paidmedialivephoto
|
|
497
501
|
'''
|
|
498
502
|
|
|
499
|
-
type: Literal['
|
|
500
|
-
|
|
501
|
-
height: Optional[int] = Field(default=None)
|
|
502
|
-
duration: Optional[int] = Field(default=None)
|
|
503
|
+
type: Literal['live_photo'] = 'live_photo' # pyright: ignore[reportIncompatibleVariableOverride]
|
|
504
|
+
live_photo: LivePhoto
|
|
503
505
|
|
|
504
506
|
class PaidMediaPhoto(PaidMedia):
|
|
505
507
|
'''
|
|
@@ -511,6 +513,18 @@ class PaidMediaPhoto(PaidMedia):
|
|
|
511
513
|
type: Literal['photo'] = 'photo' # pyright: ignore[reportIncompatibleVariableOverride]
|
|
512
514
|
photo: List[PhotoSize]
|
|
513
515
|
|
|
516
|
+
class PaidMediaPreview(PaidMedia):
|
|
517
|
+
'''
|
|
518
|
+
The paid media isn't available before the payment.
|
|
519
|
+
|
|
520
|
+
Reference: https://core.telegram.org/bots/api#paidmediapreview
|
|
521
|
+
'''
|
|
522
|
+
|
|
523
|
+
type: Literal['preview'] = 'preview' # pyright: ignore[reportIncompatibleVariableOverride]
|
|
524
|
+
width: Optional[int] = Field(default=None)
|
|
525
|
+
height: Optional[int] = Field(default=None)
|
|
526
|
+
duration: Optional[int] = Field(default=None)
|
|
527
|
+
|
|
514
528
|
class PaidMediaVideo(PaidMedia):
|
|
515
529
|
'''
|
|
516
530
|
The paid media is a video.
|
|
@@ -522,12 +536,188 @@ class PaidMediaVideo(PaidMedia):
|
|
|
522
536
|
video: Video
|
|
523
537
|
|
|
524
538
|
_PaidMedia = Union[
|
|
525
|
-
|
|
539
|
+
PaidMediaLivePhoto,
|
|
526
540
|
PaidMediaPhoto,
|
|
541
|
+
PaidMediaPreview,
|
|
527
542
|
PaidMediaVideo,
|
|
528
543
|
]
|
|
529
544
|
PaidMediaAdapter = TypeAdapter[_PaidMedia](_PaidMedia)
|
|
530
545
|
|
|
546
|
+
class InputPollMedia(BaseModel):
|
|
547
|
+
type: Literal['animation', 'audio', 'document', 'live_photo', 'location', 'photo', 'venue', 'video']
|
|
548
|
+
|
|
549
|
+
class InputMediaAnimation(InputPollMedia):
|
|
550
|
+
'''
|
|
551
|
+
Represents an animation file (GIF or H.264/MPEG-4 AVC
|
|
552
|
+
video without sound) to be sent.
|
|
553
|
+
|
|
554
|
+
Reference: https://core.telegram.org/bots/api#inputmediaanimation
|
|
555
|
+
'''
|
|
556
|
+
|
|
557
|
+
type: Literal['animation'] = 'animation' # pyright: ignore[reportIncompatibleVariableOverride]
|
|
558
|
+
media: Union[InputFile, str]
|
|
559
|
+
thumbnail: Optional[str] = Field(default=None)
|
|
560
|
+
caption: Optional[str] = Field(default=None)
|
|
561
|
+
parse_mode: Optional[str] = Field(default=None)
|
|
562
|
+
caption_entities: Optional[List[MessageEntity]] = Field(default=None)
|
|
563
|
+
show_caption_above_media: Optional[bool] = Field(default=None)
|
|
564
|
+
width: Optional[int] = Field(default=None)
|
|
565
|
+
height: Optional[int] = Field(default=None)
|
|
566
|
+
duration: Optional[int] = Field(default=None)
|
|
567
|
+
has_spoiler: Optional[bool] = Field(default=None)
|
|
568
|
+
|
|
569
|
+
class InputMediaAudio(InputPollMedia):
|
|
570
|
+
'''
|
|
571
|
+
Represents an audio file to be treated as
|
|
572
|
+
music to be sent.
|
|
573
|
+
|
|
574
|
+
Reference: https://core.telegram.org/bots/api#inputmediaaudio
|
|
575
|
+
'''
|
|
576
|
+
|
|
577
|
+
type: Literal['audio'] = 'audio' # pyright: ignore[reportIncompatibleVariableOverride]
|
|
578
|
+
media: Union[InputFile, str]
|
|
579
|
+
thumbnail: Optional[str] = Field(default=None)
|
|
580
|
+
caption: Optional[str] = Field(default=None)
|
|
581
|
+
parse_mode: Optional[str] = Field(default=None)
|
|
582
|
+
caption_entities: Optional[List[MessageEntity]] = Field(default=None)
|
|
583
|
+
duration: Optional[int] = Field(default=None)
|
|
584
|
+
performer: Optional[str] = Field(default=None)
|
|
585
|
+
title: Optional[str] = Field(default=None)
|
|
586
|
+
|
|
587
|
+
class InputMediaDocument(InputPollMedia):
|
|
588
|
+
'''
|
|
589
|
+
Represents a general file to be sent.
|
|
590
|
+
|
|
591
|
+
Reference: https://core.telegram.org/bots/api#inputmediadocument
|
|
592
|
+
'''
|
|
593
|
+
|
|
594
|
+
type: Literal['document'] = 'document' # pyright: ignore[reportIncompatibleVariableOverride]
|
|
595
|
+
media: Union[InputFile, str]
|
|
596
|
+
thumbnail: Optional[str] = Field(default=None)
|
|
597
|
+
caption: Optional[str] = Field(default=None)
|
|
598
|
+
parse_mode: Optional[str] = Field(default=None)
|
|
599
|
+
caption_entities: Optional[List[MessageEntity]] = Field(default=None)
|
|
600
|
+
disable_content_type_detection: Optional[bool] = Field(default=None)
|
|
601
|
+
|
|
602
|
+
class InputMediaLivePhoto(InputPollMedia):
|
|
603
|
+
'''
|
|
604
|
+
Represents a live photo to be sent.
|
|
605
|
+
|
|
606
|
+
Reference: https://core.telegram.org/bots/api#inputmedialivephoto
|
|
607
|
+
'''
|
|
608
|
+
|
|
609
|
+
type: Literal['live_photo'] = 'live_photo' # pyright: ignore[reportIncompatibleVariableOverride]
|
|
610
|
+
media: Union[InputFile, str]
|
|
611
|
+
photo: Union[InputFile, str]
|
|
612
|
+
caption: Optional[str] = Field(default=None)
|
|
613
|
+
parse_mode: Optional[str] = Field(default=None)
|
|
614
|
+
caption_entities: Optional[List[MessageEntity]] = Field(default=None)
|
|
615
|
+
show_caption_above_media: Optional[bool] = Field(default=None)
|
|
616
|
+
has_spoiler: Optional[bool] = Field(default=None)
|
|
617
|
+
|
|
618
|
+
class InputMediaLocation(InputPollMedia):
|
|
619
|
+
'''
|
|
620
|
+
Represents a location to be sent.
|
|
621
|
+
|
|
622
|
+
Reference: https://core.telegram.org/bots/api#inputmedialocation
|
|
623
|
+
'''
|
|
624
|
+
|
|
625
|
+
type: Literal['location'] = 'location' # pyright: ignore[reportIncompatibleVariableOverride]
|
|
626
|
+
latitude: float
|
|
627
|
+
longitude: float
|
|
628
|
+
horizontal_accuracy: Optional[float] = Field(default=None)
|
|
629
|
+
|
|
630
|
+
class InputMediaPhoto(InputPollMedia):
|
|
631
|
+
'''
|
|
632
|
+
Represents a photo to be sent.
|
|
633
|
+
|
|
634
|
+
Reference: https://core.telegram.org/bots/api#inputmediaphoto
|
|
635
|
+
'''
|
|
636
|
+
|
|
637
|
+
type: Literal['photo'] = 'photo' # pyright: ignore[reportIncompatibleVariableOverride]
|
|
638
|
+
media: Union[InputFile, str]
|
|
639
|
+
caption: Optional[str] = Field(default=None)
|
|
640
|
+
parse_mode: Optional[str] = Field(default=None)
|
|
641
|
+
caption_entities: Optional[List[MessageEntity]] = Field(default=None)
|
|
642
|
+
show_caption_above_media: Optional[bool] = Field(default=None)
|
|
643
|
+
has_spoiler: Optional[bool] = Field(default=None)
|
|
644
|
+
|
|
645
|
+
class InputMediaVenue(InputPollMedia):
|
|
646
|
+
'''
|
|
647
|
+
Represents a venue to be sent.
|
|
648
|
+
|
|
649
|
+
Reference: https://core.telegram.org/bots/api#inputmediavenue
|
|
650
|
+
'''
|
|
651
|
+
|
|
652
|
+
type: Literal['venue'] = 'venue' # pyright: ignore[reportIncompatibleVariableOverride]
|
|
653
|
+
latitude: float
|
|
654
|
+
longitude: float
|
|
655
|
+
title: str
|
|
656
|
+
address: str
|
|
657
|
+
foursquare_id: Optional[str] = Field(default=None)
|
|
658
|
+
foursquare_type: Optional[str] = Field(default=None)
|
|
659
|
+
google_place_id: Optional[str] = Field(default=None)
|
|
660
|
+
google_place_type: Optional[str] = Field(default=None)
|
|
661
|
+
|
|
662
|
+
class InputMediaVideo(InputPollMedia):
|
|
663
|
+
'''
|
|
664
|
+
Represents a video to be sent.
|
|
665
|
+
|
|
666
|
+
Reference: https://core.telegram.org/bots/api#inputmediavideo
|
|
667
|
+
'''
|
|
668
|
+
|
|
669
|
+
type: Literal['video'] = 'video' # pyright: ignore[reportIncompatibleVariableOverride]
|
|
670
|
+
media: Union[InputFile, str]
|
|
671
|
+
thumbnail: Optional[str] = Field(default=None)
|
|
672
|
+
cover: Optional[str] = Field(default=None)
|
|
673
|
+
start_timestamp: Optional[int] = Field(default=None)
|
|
674
|
+
caption: Optional[str] = Field(default=None)
|
|
675
|
+
parse_mode: Optional[str] = Field(default=None)
|
|
676
|
+
caption_entities: Optional[List[MessageEntity]] = Field(default=None)
|
|
677
|
+
show_caption_above_media: Optional[bool] = Field(default=None)
|
|
678
|
+
width: Optional[int] = Field(default=None)
|
|
679
|
+
height: Optional[int] = Field(default=None)
|
|
680
|
+
duration: Optional[int] = Field(default=None)
|
|
681
|
+
supports_streaming: Optional[bool] = Field(default=None)
|
|
682
|
+
has_spoiler: Optional[bool] = Field(default=None)
|
|
683
|
+
|
|
684
|
+
_InputPollMedia = Union[
|
|
685
|
+
InputMediaAnimation,
|
|
686
|
+
InputMediaAudio,
|
|
687
|
+
InputMediaDocument,
|
|
688
|
+
InputMediaLivePhoto,
|
|
689
|
+
InputMediaLocation,
|
|
690
|
+
InputMediaPhoto,
|
|
691
|
+
InputMediaVenue,
|
|
692
|
+
InputMediaVideo,
|
|
693
|
+
]
|
|
694
|
+
InputPollMediaAdapter = TypeAdapter[_InputPollMedia](_InputPollMedia)
|
|
695
|
+
|
|
696
|
+
class InputPollOptionMedia(BaseModel):
|
|
697
|
+
type: Literal['animation', 'live_photo', 'location', 'photo', 'sticker', 'venue', 'video']
|
|
698
|
+
|
|
699
|
+
class InputMediaSticker(InputPollOptionMedia):
|
|
700
|
+
'''
|
|
701
|
+
Represents a sticker file to be sent.
|
|
702
|
+
|
|
703
|
+
Reference: https://core.telegram.org/bots/api#inputmediasticker
|
|
704
|
+
'''
|
|
705
|
+
|
|
706
|
+
type: Literal['sticker'] = 'sticker' # pyright: ignore[reportIncompatibleVariableOverride]
|
|
707
|
+
media: Union[InputFile, str]
|
|
708
|
+
emoji: Optional[str] = Field(default=None)
|
|
709
|
+
|
|
710
|
+
_InputPollOptionMedia = Union[
|
|
711
|
+
InputMediaAnimation,
|
|
712
|
+
InputMediaLivePhoto,
|
|
713
|
+
InputMediaLocation,
|
|
714
|
+
InputMediaPhoto,
|
|
715
|
+
InputMediaSticker,
|
|
716
|
+
InputMediaVenue,
|
|
717
|
+
InputMediaVideo,
|
|
718
|
+
]
|
|
719
|
+
InputPollOptionMediaAdapter = TypeAdapter[_InputPollOptionMedia](_InputPollOptionMedia)
|
|
720
|
+
|
|
531
721
|
class BackgroundFill(BaseModel):
|
|
532
722
|
type: Literal['solid', 'gradient', 'freeform_gradient']
|
|
533
723
|
|
|
@@ -728,9 +918,45 @@ class ChatMember(BaseModel):
|
|
|
728
918
|
can_add_web_page_previews=False,
|
|
729
919
|
can_change_info=False,
|
|
730
920
|
can_invite_users=False,
|
|
731
|
-
can_pin_messages=False
|
|
921
|
+
can_pin_messages=False,
|
|
922
|
+
can_edit_tag=False,
|
|
923
|
+
can_manage_topics=False,
|
|
924
|
+
can_react_to_messages=False,
|
|
732
925
|
),
|
|
733
926
|
until_date=until_date
|
|
927
|
+
)
|
|
928
|
+
|
|
929
|
+
async def unmute(
|
|
930
|
+
self,
|
|
931
|
+
bot: bot.Bot,
|
|
932
|
+
chat_id: Union[int, str]
|
|
933
|
+
) -> bool:
|
|
934
|
+
'''
|
|
935
|
+
Unmute (un-restrict) this chat member.
|
|
936
|
+
|
|
937
|
+
From the docs: "Pass True for all permissions to lift restrictions from a user."
|
|
938
|
+
'''
|
|
939
|
+
return await bot.restrict_chat_member(
|
|
940
|
+
chat_id=chat_id,
|
|
941
|
+
user_id=self.user.id,
|
|
942
|
+
permissions=ChatPermissions(
|
|
943
|
+
can_send_messages=True,
|
|
944
|
+
can_send_audios=True,
|
|
945
|
+
can_send_documents=True,
|
|
946
|
+
can_send_photos=True,
|
|
947
|
+
can_send_videos=True,
|
|
948
|
+
can_send_video_notes=True,
|
|
949
|
+
can_send_voice_notes=True,
|
|
950
|
+
can_send_polls=True,
|
|
951
|
+
can_send_other_messages=True,
|
|
952
|
+
can_add_web_page_previews=True,
|
|
953
|
+
can_change_info=True,
|
|
954
|
+
can_invite_users=True,
|
|
955
|
+
can_pin_messages=True,
|
|
956
|
+
can_edit_tag=True,
|
|
957
|
+
can_manage_topics=True,
|
|
958
|
+
can_react_to_messages=True,
|
|
959
|
+
)
|
|
734
960
|
)
|
|
735
961
|
|
|
736
962
|
|
|
@@ -811,6 +1037,7 @@ class ChatMemberRestricted(ChatMember):
|
|
|
811
1037
|
can_send_polls: bool
|
|
812
1038
|
can_send_other_messages: bool
|
|
813
1039
|
can_add_web_page_previews: bool
|
|
1040
|
+
can_react_to_messages: bool
|
|
814
1041
|
can_edit_tag: bool
|
|
815
1042
|
can_change_info: bool
|
|
816
1043
|
can_invite_users: bool
|
|
@@ -1212,115 +1439,38 @@ _ChatBoostSource = Union[
|
|
|
1212
1439
|
ChatBoostSourceAdapter = TypeAdapter[_ChatBoostSource](_ChatBoostSource)
|
|
1213
1440
|
|
|
1214
1441
|
class InputMedia(BaseModel):
|
|
1215
|
-
type: Literal['animation', 'document', '
|
|
1442
|
+
type: Literal['animation', 'audio', 'document', 'live_photo', 'photo', 'video']
|
|
1216
1443
|
media: Union[InputFile, str]
|
|
1217
1444
|
caption: Optional[str] = Field(default=None)
|
|
1218
1445
|
parse_mode: Optional[str] = Field(default=None)
|
|
1219
1446
|
caption_entities: Optional[List[MessageEntity]] = Field(default=None)
|
|
1220
1447
|
|
|
1221
|
-
class InputMediaAnimation(InputMedia):
|
|
1222
|
-
'''
|
|
1223
|
-
Represents an animation file (GIF or H.264/MPEG-4 AVC
|
|
1224
|
-
video without sound) to be sent.
|
|
1225
|
-
|
|
1226
|
-
Reference: https://core.telegram.org/bots/api#inputmediaanimation
|
|
1227
|
-
'''
|
|
1228
|
-
|
|
1229
|
-
type: Literal['animation'] = 'animation' # pyright: ignore[reportIncompatibleVariableOverride]
|
|
1230
|
-
media: Union[InputFile, str]
|
|
1231
|
-
thumbnail: Optional[str] = Field(default=None)
|
|
1232
|
-
caption: Optional[str] = Field(default=None)
|
|
1233
|
-
parse_mode: Optional[str] = Field(default=None)
|
|
1234
|
-
caption_entities: Optional[List[MessageEntity]] = Field(default=None)
|
|
1235
|
-
show_caption_above_media: Optional[bool] = Field(default=None)
|
|
1236
|
-
width: Optional[int] = Field(default=None)
|
|
1237
|
-
height: Optional[int] = Field(default=None)
|
|
1238
|
-
duration: Optional[int] = Field(default=None)
|
|
1239
|
-
has_spoiler: Optional[bool] = Field(default=None)
|
|
1240
|
-
|
|
1241
|
-
class InputMediaDocument(InputMedia):
|
|
1242
|
-
'''
|
|
1243
|
-
Represents a general file to be sent.
|
|
1244
|
-
|
|
1245
|
-
Reference: https://core.telegram.org/bots/api#inputmediadocument
|
|
1246
|
-
'''
|
|
1247
|
-
|
|
1248
|
-
type: Literal['document'] = 'document' # pyright: ignore[reportIncompatibleVariableOverride]
|
|
1249
|
-
media: Union[InputFile, str]
|
|
1250
|
-
thumbnail: Optional[str] = Field(default=None)
|
|
1251
|
-
caption: Optional[str] = Field(default=None)
|
|
1252
|
-
parse_mode: Optional[str] = Field(default=None)
|
|
1253
|
-
caption_entities: Optional[List[MessageEntity]] = Field(default=None)
|
|
1254
|
-
disable_content_type_detection: Optional[bool] = Field(default=None)
|
|
1255
|
-
|
|
1256
|
-
class InputMediaAudio(InputMedia):
|
|
1257
|
-
'''
|
|
1258
|
-
Represents an audio file to be treated as
|
|
1259
|
-
music to be sent.
|
|
1260
|
-
|
|
1261
|
-
Reference: https://core.telegram.org/bots/api#inputmediaaudio
|
|
1262
|
-
'''
|
|
1263
|
-
|
|
1264
|
-
type: Literal['audio'] = 'audio' # pyright: ignore[reportIncompatibleVariableOverride]
|
|
1265
|
-
media: Union[InputFile, str]
|
|
1266
|
-
thumbnail: Optional[str] = Field(default=None)
|
|
1267
|
-
caption: Optional[str] = Field(default=None)
|
|
1268
|
-
parse_mode: Optional[str] = Field(default=None)
|
|
1269
|
-
caption_entities: Optional[List[MessageEntity]] = Field(default=None)
|
|
1270
|
-
duration: Optional[int] = Field(default=None)
|
|
1271
|
-
performer: Optional[str] = Field(default=None)
|
|
1272
|
-
title: Optional[str] = Field(default=None)
|
|
1273
|
-
|
|
1274
|
-
class InputMediaPhoto(InputMedia):
|
|
1275
|
-
'''
|
|
1276
|
-
Represents a photo to be sent.
|
|
1277
|
-
|
|
1278
|
-
Reference: https://core.telegram.org/bots/api#inputmediaphoto
|
|
1279
|
-
'''
|
|
1280
|
-
|
|
1281
|
-
type: Literal['photo'] = 'photo' # pyright: ignore[reportIncompatibleVariableOverride]
|
|
1282
|
-
media: Union[InputFile, str]
|
|
1283
|
-
caption: Optional[str] = Field(default=None)
|
|
1284
|
-
parse_mode: Optional[str] = Field(default=None)
|
|
1285
|
-
caption_entities: Optional[List[MessageEntity]] = Field(default=None)
|
|
1286
|
-
show_caption_above_media: Optional[bool] = Field(default=None)
|
|
1287
|
-
has_spoiler: Optional[bool] = Field(default=None)
|
|
1288
|
-
|
|
1289
|
-
class InputMediaVideo(InputMedia):
|
|
1290
|
-
'''
|
|
1291
|
-
Represents a video to be sent.
|
|
1292
|
-
|
|
1293
|
-
Reference: https://core.telegram.org/bots/api#inputmediavideo
|
|
1294
|
-
'''
|
|
1295
|
-
|
|
1296
|
-
type: Literal['video'] = 'video' # pyright: ignore[reportIncompatibleVariableOverride]
|
|
1297
|
-
media: Union[InputFile, str]
|
|
1298
|
-
thumbnail: Optional[str] = Field(default=None)
|
|
1299
|
-
cover: Optional[str] = Field(default=None)
|
|
1300
|
-
start_timestamp: Optional[int] = Field(default=None)
|
|
1301
|
-
caption: Optional[str] = Field(default=None)
|
|
1302
|
-
parse_mode: Optional[str] = Field(default=None)
|
|
1303
|
-
caption_entities: Optional[List[MessageEntity]] = Field(default=None)
|
|
1304
|
-
show_caption_above_media: Optional[bool] = Field(default=None)
|
|
1305
|
-
width: Optional[int] = Field(default=None)
|
|
1306
|
-
height: Optional[int] = Field(default=None)
|
|
1307
|
-
duration: Optional[int] = Field(default=None)
|
|
1308
|
-
supports_streaming: Optional[bool] = Field(default=None)
|
|
1309
|
-
has_spoiler: Optional[bool] = Field(default=None)
|
|
1310
|
-
|
|
1311
1448
|
_InputMedia = Union[
|
|
1312
1449
|
InputMediaAnimation,
|
|
1313
|
-
InputMediaDocument,
|
|
1314
1450
|
InputMediaAudio,
|
|
1451
|
+
InputMediaDocument,
|
|
1452
|
+
InputMediaLivePhoto,
|
|
1315
1453
|
InputMediaPhoto,
|
|
1316
1454
|
InputMediaVideo,
|
|
1317
1455
|
]
|
|
1318
1456
|
InputMediaAdapter = TypeAdapter[_InputMedia](_InputMedia)
|
|
1319
1457
|
|
|
1320
1458
|
class InputPaidMedia(BaseModel):
|
|
1321
|
-
type: Literal['photo', 'video']
|
|
1459
|
+
type: Literal['live_photo', 'photo', 'video']
|
|
1322
1460
|
media: Union[InputFile, str]
|
|
1323
1461
|
|
|
1462
|
+
class InputPaidMediaLivePhoto(InputPaidMedia):
|
|
1463
|
+
'''
|
|
1464
|
+
The paid media to send is a live
|
|
1465
|
+
photo.
|
|
1466
|
+
|
|
1467
|
+
Reference: https://core.telegram.org/bots/api#inputpaidmedialivephoto
|
|
1468
|
+
'''
|
|
1469
|
+
|
|
1470
|
+
type: Literal['live_photo'] = 'live_photo' # pyright: ignore[reportIncompatibleVariableOverride]
|
|
1471
|
+
media: Union[InputFile, str]
|
|
1472
|
+
photo: Union[InputFile, str]
|
|
1473
|
+
|
|
1324
1474
|
class InputPaidMediaPhoto(InputPaidMedia):
|
|
1325
1475
|
'''
|
|
1326
1476
|
The paid media to send is a photo.
|
|
@@ -1349,6 +1499,7 @@ class InputPaidMediaVideo(InputPaidMedia):
|
|
|
1349
1499
|
supports_streaming: Optional[bool] = Field(default=None)
|
|
1350
1500
|
|
|
1351
1501
|
_InputPaidMedia = Union[
|
|
1502
|
+
InputPaidMediaLivePhoto,
|
|
1352
1503
|
InputPaidMediaPhoto,
|
|
1353
1504
|
InputPaidMediaVideo,
|
|
1354
1505
|
]
|
|
@@ -2302,7 +2453,7 @@ PassportElementErrorAdapter = TypeAdapter[_PassportElementError](_PassportElemen
|
|
|
2302
2453
|
class Update(BaseModel):
|
|
2303
2454
|
'''
|
|
2304
2455
|
This object represents an incoming update.At most one
|
|
2305
|
-
of the optional
|
|
2456
|
+
of the optional fields can be present in
|
|
2306
2457
|
any given update.
|
|
2307
2458
|
|
|
2308
2459
|
Reference: https://core.telegram.org/bots/api#update
|
|
@@ -2317,6 +2468,7 @@ class Update(BaseModel):
|
|
|
2317
2468
|
business_message: Optional[Message] = Field(default=None)
|
|
2318
2469
|
edited_business_message: Optional[Message] = Field(default=None)
|
|
2319
2470
|
deleted_business_messages: Optional[BusinessMessagesDeleted] = Field(default=None)
|
|
2471
|
+
guest_message: Optional[Message] = Field(default=None)
|
|
2320
2472
|
message_reaction: Optional[MessageReactionUpdated] = Field(default=None)
|
|
2321
2473
|
message_reaction_count: Optional[MessageReactionCountUpdated] = Field(default=None)
|
|
2322
2474
|
inline_query: Optional[InlineQuery] = Field(default=None)
|
|
@@ -2378,6 +2530,7 @@ class User(BaseModel):
|
|
|
2378
2530
|
added_to_attachment_menu: Optional[bool] = Field(default=None)
|
|
2379
2531
|
can_join_groups: Optional[bool] = Field(default=None)
|
|
2380
2532
|
can_read_all_group_messages: Optional[bool] = Field(default=None)
|
|
2533
|
+
supports_guest_queries: Optional[bool] = Field(default=None)
|
|
2381
2534
|
supports_inline_queries: Optional[bool] = Field(default=None)
|
|
2382
2535
|
can_connect_to_business: Optional[bool] = Field(default=None)
|
|
2383
2536
|
has_main_web_app: Optional[bool] = Field(default=None)
|
|
@@ -2536,6 +2689,7 @@ class ExternalReplyInfo(BaseModel):
|
|
|
2536
2689
|
animation: Optional[Animation] = Field(default=None)
|
|
2537
2690
|
audio: Optional[Audio] = Field(default=None)
|
|
2538
2691
|
document: Optional[Document] = Field(default=None)
|
|
2692
|
+
live_photo: Optional[LivePhoto] = Field(default=None)
|
|
2539
2693
|
paid_media: Optional[PaidMediaInfo] = Field(default=None)
|
|
2540
2694
|
photo: Optional[List[PhotoSize]] = Field(default=None)
|
|
2541
2695
|
sticker: Optional[Sticker] = Field(default=None)
|
|
@@ -2638,6 +2792,22 @@ class Document(BaseModel):
|
|
|
2638
2792
|
mime_type: Optional[str] = Field(default=None)
|
|
2639
2793
|
file_size: Optional[int] = Field(default=None)
|
|
2640
2794
|
|
|
2795
|
+
class LivePhoto(BaseModel):
|
|
2796
|
+
'''
|
|
2797
|
+
This object represents a live photo.
|
|
2798
|
+
|
|
2799
|
+
Reference: https://core.telegram.org/bots/api#livephoto
|
|
2800
|
+
'''
|
|
2801
|
+
|
|
2802
|
+
file_id: str
|
|
2803
|
+
file_unique_id: str
|
|
2804
|
+
width: int
|
|
2805
|
+
height: int
|
|
2806
|
+
duration: int
|
|
2807
|
+
photo: Optional[List[PhotoSize]] = Field(default=None)
|
|
2808
|
+
mime_type: Optional[str] = Field(default=None)
|
|
2809
|
+
file_size: Optional[int] = Field(default=None)
|
|
2810
|
+
|
|
2641
2811
|
class Story(BaseModel):
|
|
2642
2812
|
'''
|
|
2643
2813
|
This object represents a story.
|
|
@@ -2745,6 +2915,24 @@ class Dice(BaseModel):
|
|
|
2745
2915
|
emoji: str
|
|
2746
2916
|
value: int
|
|
2747
2917
|
|
|
2918
|
+
class PollMedia(BaseModel):
|
|
2919
|
+
'''
|
|
2920
|
+
At most one of the optional fields can
|
|
2921
|
+
be present in any given object.
|
|
2922
|
+
|
|
2923
|
+
Reference: https://core.telegram.org/bots/api#pollmedia
|
|
2924
|
+
'''
|
|
2925
|
+
|
|
2926
|
+
animation: Optional[Animation] = Field(default=None)
|
|
2927
|
+
audio: Optional[Audio] = Field(default=None)
|
|
2928
|
+
document: Optional[Document] = Field(default=None)
|
|
2929
|
+
live_photo: Optional[LivePhoto] = Field(default=None)
|
|
2930
|
+
location: Optional[Location] = Field(default=None)
|
|
2931
|
+
photo: Optional[List[PhotoSize]] = Field(default=None)
|
|
2932
|
+
sticker: Optional[Sticker] = Field(default=None)
|
|
2933
|
+
venue: Optional[Venue] = Field(default=None)
|
|
2934
|
+
video: Optional[Video] = Field(default=None)
|
|
2935
|
+
|
|
2748
2936
|
class PollOption(BaseModel):
|
|
2749
2937
|
'''
|
|
2750
2938
|
This object contains information about one answer option
|
|
@@ -2757,6 +2945,7 @@ class PollOption(BaseModel):
|
|
|
2757
2945
|
text: str
|
|
2758
2946
|
voter_count: int
|
|
2759
2947
|
text_entities: Optional[List[MessageEntity]] = Field(default=None)
|
|
2948
|
+
media: Optional[PollMedia] = Field(default=None)
|
|
2760
2949
|
added_by_user: Optional[User] = Field(default=None)
|
|
2761
2950
|
added_by_chat: Optional[Chat] = Field(default=None)
|
|
2762
2951
|
addition_date: Optional[int] = Field(default=None)
|
|
@@ -2771,7 +2960,8 @@ class InputPollOption(BaseModel):
|
|
|
2771
2960
|
|
|
2772
2961
|
text: str
|
|
2773
2962
|
text_parse_mode: Optional[str] = Field(default=None)
|
|
2774
|
-
text_entities: Optional[List[MessageEntity]] = Field(default=None)
|
|
2963
|
+
text_entities: Optional[List[MessageEntity]] = Field(default=None)
|
|
2964
|
+
media: Optional[_InputPollOptionMedia] = Field(default=None)
|
|
2775
2965
|
|
|
2776
2966
|
class PollAnswer(BaseModel):
|
|
2777
2967
|
'''
|
|
@@ -2803,14 +2993,18 @@ class Poll(BaseModel):
|
|
|
2803
2993
|
type: str
|
|
2804
2994
|
allows_multiple_answers: bool
|
|
2805
2995
|
allows_revoting: bool
|
|
2996
|
+
members_only: bool
|
|
2806
2997
|
question_entities: Optional[List[MessageEntity]] = Field(default=None)
|
|
2998
|
+
country_codes: Optional[List[str]] = Field(default=None)
|
|
2807
2999
|
correct_option_ids: Optional[List[int]] = Field(default=None)
|
|
2808
3000
|
explanation: Optional[str] = Field(default=None)
|
|
2809
3001
|
explanation_entities: Optional[List[MessageEntity]] = Field(default=None)
|
|
3002
|
+
explanation_media: Optional[PollMedia] = Field(default=None)
|
|
2810
3003
|
open_period: Optional[int] = Field(default=None)
|
|
2811
3004
|
close_date: Optional[int] = Field(default=None)
|
|
2812
3005
|
description: Optional[str] = Field(default=None)
|
|
2813
|
-
description_entities: Optional[List[MessageEntity]] = Field(default=None)
|
|
3006
|
+
description_entities: Optional[List[MessageEntity]] = Field(default=None)
|
|
3007
|
+
media: Optional[PollMedia] = Field(default=None)
|
|
2814
3008
|
|
|
2815
3009
|
class ChecklistTask(BaseModel):
|
|
2816
3010
|
'''
|
|
@@ -3485,7 +3679,7 @@ class ReplyKeyboardMarkup(BaseModel):
|
|
|
3485
3679
|
This object represents a custom keyboard with reply
|
|
3486
3680
|
options (see Introduction to bots for details and
|
|
3487
3681
|
examples). Not supported in channels and for messages
|
|
3488
|
-
sent on behalf of a
|
|
3682
|
+
sent on behalf of a business account.
|
|
3489
3683
|
|
|
3490
3684
|
Reference: https://core.telegram.org/bots/api#replykeyboardmarkup
|
|
3491
3685
|
'''
|
|
@@ -3598,7 +3792,7 @@ class ReplyKeyboardRemove(BaseModel):
|
|
|
3598
3792
|
one-time keyboards that are hidden immediately after the
|
|
3599
3793
|
user presses a button (see ReplyKeyboardMarkup). Not supported
|
|
3600
3794
|
in channels and for messages sent on behalf
|
|
3601
|
-
of a
|
|
3795
|
+
of a business account.
|
|
3602
3796
|
|
|
3603
3797
|
Reference: https://core.telegram.org/bots/api#replykeyboardremove
|
|
3604
3798
|
'''
|
|
@@ -3730,7 +3924,7 @@ class ForceReply(BaseModel):
|
|
|
3730
3924
|
be extremely useful if you want to create
|
|
3731
3925
|
user-friendly step-by-step interfaces without having to sacrifice privacy
|
|
3732
3926
|
mode. Not supported in channels and for messages
|
|
3733
|
-
sent on behalf of a
|
|
3927
|
+
sent on behalf of a user account.
|
|
3734
3928
|
|
|
3735
3929
|
Reference: https://core.telegram.org/bots/api#forcereply
|
|
3736
3930
|
'''
|
|
@@ -3870,6 +4064,7 @@ class ChatPermissions(BaseModel):
|
|
|
3870
4064
|
can_send_polls: Optional[bool] = Field(default=None)
|
|
3871
4065
|
can_send_other_messages: Optional[bool] = Field(default=None)
|
|
3872
4066
|
can_add_web_page_previews: Optional[bool] = Field(default=None)
|
|
4067
|
+
can_react_to_messages: Optional[bool] = Field(default=None)
|
|
3873
4068
|
can_edit_tag: Optional[bool] = Field(default=None)
|
|
3874
4069
|
can_change_info: Optional[bool] = Field(default=None)
|
|
3875
4070
|
can_invite_users: Optional[bool] = Field(default=None)
|
|
@@ -4221,6 +4416,17 @@ class OwnedGifts(BaseModel):
|
|
|
4221
4416
|
gifts: List[_OwnedGift]
|
|
4222
4417
|
next_offset: Optional[str] = Field(default=None)
|
|
4223
4418
|
|
|
4419
|
+
class BotAccessSettings(BaseModel):
|
|
4420
|
+
'''
|
|
4421
|
+
This object describes the access settings of a
|
|
4422
|
+
bot.
|
|
4423
|
+
|
|
4424
|
+
Reference: https://core.telegram.org/bots/api#botaccesssettings
|
|
4425
|
+
'''
|
|
4426
|
+
|
|
4427
|
+
is_access_restricted: bool
|
|
4428
|
+
added_users: Optional[List[User]] = Field(default=None)
|
|
4429
|
+
|
|
4224
4430
|
class AcceptedGiftTypes(BaseModel):
|
|
4225
4431
|
'''
|
|
4226
4432
|
This object describes the types of gifts that
|
|
@@ -4408,6 +4614,16 @@ class SentWebAppMessage(BaseModel):
|
|
|
4408
4614
|
|
|
4409
4615
|
inline_message_id: Optional[str] = Field(default=None)
|
|
4410
4616
|
|
|
4617
|
+
class SentGuestMessage(BaseModel):
|
|
4618
|
+
'''
|
|
4619
|
+
Describes an inline message sent by a guest
|
|
4620
|
+
bot.
|
|
4621
|
+
|
|
4622
|
+
Reference: https://core.telegram.org/bots/api#sentguestmessage
|
|
4623
|
+
'''
|
|
4624
|
+
|
|
4625
|
+
inline_message_id: str
|
|
4626
|
+
|
|
4411
4627
|
class PreparedInlineMessage(BaseModel):
|
|
4412
4628
|
'''
|
|
4413
4629
|
Describes an inline message to be sent by
|
|
@@ -4877,12 +5093,14 @@ MediaTypeUnion = Union[
|
|
|
4877
5093
|
VideoNote,
|
|
4878
5094
|
Voice,
|
|
4879
5095
|
Story,
|
|
4880
|
-
PaidMedia
|
|
5096
|
+
PaidMedia,
|
|
5097
|
+
LivePhoto
|
|
4881
5098
|
]
|
|
4882
5099
|
|
|
4883
5100
|
_InputMediaGroupTypes = Union[
|
|
4884
5101
|
InputMediaAudio,
|
|
4885
5102
|
InputMediaDocument,
|
|
5103
|
+
InputMediaLivePhoto,
|
|
4886
5104
|
InputMediaPhoto,
|
|
4887
5105
|
InputMediaVideo,
|
|
4888
5106
|
]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|