botapi-py 1.5.11__tar.gz → 1.5.13__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: botapi-py
3
- Version: 1.5.11
3
+ Version: 1.5.13
4
4
  Summary: A simple and flexible Python library to conveniently build fast Telegram bots using the Bot API.
5
5
  Requires-Dist: httpx>=0.28.1
6
6
  Requires-Dist: pydantic>=2.12.0
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "botapi-py"
3
- version = "1.5.11"
3
+ version = "1.5.13"
4
4
  description = "A simple and flexible Python library to conveniently build fast Telegram bots using the Bot API."
5
5
  # readme = "README.md"
6
6
  # authors = [
@@ -21,7 +21,7 @@ redis = [
21
21
  ]
22
22
 
23
23
  [build-system]
24
- requires = ["uv_build>=0.9.0,<0.10.0"]
24
+ requires = ["uv_build>=0.9.0,<0.12.0"]
25
25
  build-backend = "uv_build"
26
26
 
27
27
  [dependency-groups]
@@ -86,6 +86,10 @@ class BaseBot:
86
86
  '''
87
87
  Sends a POST request to the Telegram Bot API.
88
88
  '''
89
+ # TODO: request fix on the botAPI server, or fix in a cleaner way...
90
+ if 'receiver_user_id' in data and data['receiver_user_id'] is None:
91
+ del data['receiver_user_id']
92
+
89
93
  converted_data, files = self._convert_data(data)
90
94
 
91
95
  request = await self.session.post(
@@ -26,6 +26,7 @@ from .types import (
26
26
  TextQuote,
27
27
  ExternalReplyInfo,
28
28
  ReplyParameters,
29
+ EphemeralMessageParameters,
29
30
  MessageOrigin,
30
31
  _MessageOrigin,
31
32
  MessageOriginAdapter,
@@ -77,6 +78,7 @@ from .types import (
77
78
  ManagedBotCreated,
78
79
  ManagedBotUpdated,
79
80
  BotSubscriptionUpdated,
81
+ MessageGenerationStopped,
80
82
  PollOptionAdded,
81
83
  PollOptionDeleted,
82
84
  ChatBoostAdded,
@@ -97,6 +99,7 @@ from .types import (
97
99
  ChecklistTasksDone,
98
100
  ChecklistTasksAdded,
99
101
  CommunityChatAdded,
102
+ CommunityChatJoined,
100
103
  CommunityChatRemoved,
101
104
  ForumTopicCreated,
102
105
  ForumTopicClosed,
@@ -144,6 +147,7 @@ from .types import (
144
147
  LoginUrl,
145
148
  SwitchInlineQueryChosenChat,
146
149
  CopyTextButton,
150
+ DisabledButton,
147
151
  CallbackQuery,
148
152
  ForceReply,
149
153
  Community,
@@ -288,6 +292,7 @@ from .types import (
288
292
  RichMessage,
289
293
  InputRichMessage,
290
294
  InputRichMessageMedia,
295
+ RichMessageButton,
291
296
  RichText,
292
297
  _RichText,
293
298
  RichTextAdapter,
@@ -312,6 +317,7 @@ from .types import (
312
317
  RichTextHashtag,
313
318
  RichTextCashtag,
314
319
  RichTextBotCommand,
320
+ RichTextButton,
315
321
  RichTextAnchor,
316
322
  RichTextAnchorLink,
317
323
  RichTextReference,
@@ -331,14 +337,17 @@ from .types import (
331
337
  RichBlockAnchor,
332
338
  RichBlockList,
333
339
  RichBlockBlockQuotation,
340
+ RichBlockExpandableBlockQuotation,
334
341
  RichBlockPullQuotation,
335
342
  RichBlockCollage,
336
343
  RichBlockSlideshow,
337
344
  RichBlockTable,
338
345
  RichBlockDetails,
339
346
  RichBlockMap,
347
+ RichBlockButtons,
340
348
  RichBlockAnimation,
341
349
  RichBlockAudio,
350
+ RichBlockDocument,
342
351
  RichBlockPhoto,
343
352
  RichBlockVideo,
344
353
  RichBlockVoiceNote,
@@ -356,14 +365,17 @@ from .types import (
356
365
  InputRichBlockAnchor,
357
366
  InputRichBlockList,
358
367
  InputRichBlockBlockQuotation,
368
+ InputRichBlockExpandableBlockQuotation,
359
369
  InputRichBlockPullQuotation,
360
370
  InputRichBlockCollage,
361
371
  InputRichBlockSlideshow,
362
372
  InputRichBlockTable,
363
373
  InputRichBlockDetails,
364
374
  InputRichBlockMap,
375
+ InputRichBlockButtons,
365
376
  InputRichBlockAnimation,
366
377
  InputRichBlockAudio,
378
+ InputRichBlockDocument,
367
379
  InputRichBlockPhoto,
368
380
  InputRichBlockVideo,
369
381
  InputRichBlockVoiceNote,
@@ -609,8 +621,7 @@ class Methods(core.BaseBot):
609
621
  business_connection_id: Optional[str] = None,
610
622
  message_thread_id: Optional[int] = None,
611
623
  direct_messages_topic_id: Optional[int] = None,
612
- receiver_user_id: Optional[int] = None,
613
- callback_query_id: Optional[str] = None,
624
+ ephemeral_message_parameters: Optional[EphemeralMessageParameters] = None,
614
625
  parse_mode: Optional[Union[str, enums.ParseMode]] = None,
615
626
  entities: Optional[List[MessageEntity]] = None,
616
627
  link_preview_options: Optional[LinkPreviewOptions] = None,
@@ -634,8 +645,7 @@ class Methods(core.BaseBot):
634
645
  'chat_id': chat_id,
635
646
  'message_thread_id': message_thread_id,
636
647
  'direct_messages_topic_id': direct_messages_topic_id,
637
- 'receiver_user_id': receiver_user_id,
638
- 'callback_query_id': callback_query_id,
648
+ 'ephemeral_message_parameters': ephemeral_message_parameters,
639
649
  'text': text,
640
650
  'parse_mode': parse_mode,
641
651
  'entities': entities,
@@ -823,8 +833,7 @@ class Methods(core.BaseBot):
823
833
  business_connection_id: Optional[str] = None,
824
834
  message_thread_id: Optional[int] = None,
825
835
  direct_messages_topic_id: Optional[int] = None,
826
- receiver_user_id: Optional[int] = None,
827
- callback_query_id: Optional[str] = None,
836
+ ephemeral_message_parameters: Optional[EphemeralMessageParameters] = None,
828
837
  caption: Optional[str] = None,
829
838
  parse_mode: Optional[Union[str, enums.ParseMode]] = None,
830
839
  caption_entities: Optional[List[MessageEntity]] = None,
@@ -850,8 +859,7 @@ class Methods(core.BaseBot):
850
859
  'chat_id': chat_id,
851
860
  'message_thread_id': message_thread_id,
852
861
  'direct_messages_topic_id': direct_messages_topic_id,
853
- 'receiver_user_id': receiver_user_id,
854
- 'callback_query_id': callback_query_id,
862
+ 'ephemeral_message_parameters': ephemeral_message_parameters,
855
863
  'photo': photo,
856
864
  'caption': caption,
857
865
  'parse_mode': parse_mode,
@@ -876,8 +884,7 @@ class Methods(core.BaseBot):
876
884
  business_connection_id: Optional[str] = None,
877
885
  message_thread_id: Optional[int] = None,
878
886
  direct_messages_topic_id: Optional[int] = None,
879
- receiver_user_id: Optional[int] = None,
880
- callback_query_id: Optional[str] = None,
887
+ ephemeral_message_parameters: Optional[EphemeralMessageParameters] = None,
881
888
  caption: Optional[str] = None,
882
889
  parse_mode: Optional[Union[str, enums.ParseMode]] = None,
883
890
  caption_entities: Optional[List[MessageEntity]] = None,
@@ -903,8 +910,7 @@ class Methods(core.BaseBot):
903
910
  'chat_id': chat_id,
904
911
  'message_thread_id': message_thread_id,
905
912
  'direct_messages_topic_id': direct_messages_topic_id,
906
- 'receiver_user_id': receiver_user_id,
907
- 'callback_query_id': callback_query_id,
913
+ 'ephemeral_message_parameters': ephemeral_message_parameters,
908
914
  'live_photo': live_photo,
909
915
  'photo': photo,
910
916
  'caption': caption,
@@ -929,8 +935,7 @@ class Methods(core.BaseBot):
929
935
  business_connection_id: Optional[str] = None,
930
936
  message_thread_id: Optional[int] = None,
931
937
  direct_messages_topic_id: Optional[int] = None,
932
- receiver_user_id: Optional[int] = None,
933
- callback_query_id: Optional[str] = None,
938
+ ephemeral_message_parameters: Optional[EphemeralMessageParameters] = None,
934
939
  caption: Optional[str] = None,
935
940
  parse_mode: Optional[Union[str, enums.ParseMode]] = None,
936
941
  caption_entities: Optional[List[MessageEntity]] = None,
@@ -964,8 +969,7 @@ class Methods(core.BaseBot):
964
969
  'chat_id': chat_id,
965
970
  'message_thread_id': message_thread_id,
966
971
  'direct_messages_topic_id': direct_messages_topic_id,
967
- 'receiver_user_id': receiver_user_id,
968
- 'callback_query_id': callback_query_id,
972
+ 'ephemeral_message_parameters': ephemeral_message_parameters,
969
973
  'audio': audio,
970
974
  'caption': caption,
971
975
  'parse_mode': parse_mode,
@@ -991,8 +995,7 @@ class Methods(core.BaseBot):
991
995
  business_connection_id: Optional[str] = None,
992
996
  message_thread_id: Optional[int] = None,
993
997
  direct_messages_topic_id: Optional[int] = None,
994
- receiver_user_id: Optional[int] = None,
995
- callback_query_id: Optional[str] = None,
998
+ ephemeral_message_parameters: Optional[EphemeralMessageParameters] = None,
996
999
  thumbnail: Optional[Union[InputFile, str]] = None,
997
1000
  caption: Optional[str] = None,
998
1001
  parse_mode: Optional[Union[str, enums.ParseMode]] = None,
@@ -1021,8 +1024,7 @@ class Methods(core.BaseBot):
1021
1024
  'chat_id': chat_id,
1022
1025
  'message_thread_id': message_thread_id,
1023
1026
  'direct_messages_topic_id': direct_messages_topic_id,
1024
- 'receiver_user_id': receiver_user_id,
1025
- 'callback_query_id': callback_query_id,
1027
+ 'ephemeral_message_parameters': ephemeral_message_parameters,
1026
1028
  'document': document,
1027
1029
  'thumbnail': thumbnail,
1028
1030
  'caption': caption,
@@ -1046,8 +1048,7 @@ class Methods(core.BaseBot):
1046
1048
  business_connection_id: Optional[str] = None,
1047
1049
  message_thread_id: Optional[int] = None,
1048
1050
  direct_messages_topic_id: Optional[int] = None,
1049
- receiver_user_id: Optional[int] = None,
1050
- callback_query_id: Optional[str] = None,
1051
+ ephemeral_message_parameters: Optional[EphemeralMessageParameters] = None,
1051
1052
  duration: Optional[int] = None,
1052
1053
  width: Optional[int] = None,
1053
1054
  height: Optional[int] = None,
@@ -1084,8 +1085,7 @@ class Methods(core.BaseBot):
1084
1085
  'chat_id': chat_id,
1085
1086
  'message_thread_id': message_thread_id,
1086
1087
  'direct_messages_topic_id': direct_messages_topic_id,
1087
- 'receiver_user_id': receiver_user_id,
1088
- 'callback_query_id': callback_query_id,
1088
+ 'ephemeral_message_parameters': ephemeral_message_parameters,
1089
1089
  'video': video,
1090
1090
  'duration': duration,
1091
1091
  'width': width,
@@ -1116,8 +1116,7 @@ class Methods(core.BaseBot):
1116
1116
  business_connection_id: Optional[str] = None,
1117
1117
  message_thread_id: Optional[int] = None,
1118
1118
  direct_messages_topic_id: Optional[int] = None,
1119
- receiver_user_id: Optional[int] = None,
1120
- callback_query_id: Optional[str] = None,
1119
+ ephemeral_message_parameters: Optional[EphemeralMessageParameters] = None,
1121
1120
  duration: Optional[int] = None,
1122
1121
  width: Optional[int] = None,
1123
1122
  height: Optional[int] = None,
@@ -1151,8 +1150,7 @@ class Methods(core.BaseBot):
1151
1150
  'chat_id': chat_id,
1152
1151
  'message_thread_id': message_thread_id,
1153
1152
  'direct_messages_topic_id': direct_messages_topic_id,
1154
- 'receiver_user_id': receiver_user_id,
1155
- 'callback_query_id': callback_query_id,
1153
+ 'ephemeral_message_parameters': ephemeral_message_parameters,
1156
1154
  'animation': animation,
1157
1155
  'duration': duration,
1158
1156
  'width': width,
@@ -1180,8 +1178,7 @@ class Methods(core.BaseBot):
1180
1178
  business_connection_id: Optional[str] = None,
1181
1179
  message_thread_id: Optional[int] = None,
1182
1180
  direct_messages_topic_id: Optional[int] = None,
1183
- receiver_user_id: Optional[int] = None,
1184
- callback_query_id: Optional[str] = None,
1181
+ ephemeral_message_parameters: Optional[EphemeralMessageParameters] = None,
1185
1182
  caption: Optional[str] = None,
1186
1183
  parse_mode: Optional[Union[str, enums.ParseMode]] = None,
1187
1184
  caption_entities: Optional[List[MessageEntity]] = None,
@@ -1215,8 +1212,7 @@ class Methods(core.BaseBot):
1215
1212
  'chat_id': chat_id,
1216
1213
  'message_thread_id': message_thread_id,
1217
1214
  'direct_messages_topic_id': direct_messages_topic_id,
1218
- 'receiver_user_id': receiver_user_id,
1219
- 'callback_query_id': callback_query_id,
1215
+ 'ephemeral_message_parameters': ephemeral_message_parameters,
1220
1216
  'voice': voice,
1221
1217
  'caption': caption,
1222
1218
  'parse_mode': parse_mode,
@@ -1239,8 +1235,7 @@ class Methods(core.BaseBot):
1239
1235
  business_connection_id: Optional[str] = None,
1240
1236
  message_thread_id: Optional[int] = None,
1241
1237
  direct_messages_topic_id: Optional[int] = None,
1242
- receiver_user_id: Optional[int] = None,
1243
- callback_query_id: Optional[str] = None,
1238
+ ephemeral_message_parameters: Optional[EphemeralMessageParameters] = None,
1244
1239
  duration: Optional[int] = None,
1245
1240
  length: Optional[int] = None,
1246
1241
  thumbnail: Optional[Union[InputFile, str]] = None,
@@ -1253,10 +1248,9 @@ class Methods(core.BaseBot):
1253
1248
  reply_markup: Optional[Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]] = None,
1254
1249
  ) -> Message:
1255
1250
  '''
1256
- As of v.4.0, Telegram clients support rounded square
1257
- MPEG4 videos of up to 1 minute long.
1258
- Use this method to send video messages. On
1259
- success, the sent Message is returned.
1251
+ Use this method to send a rounded square
1252
+ MPEG4 video of up to 1 minute long.
1253
+ On success, the sent Message is returned.
1260
1254
 
1261
1255
  Reference: https://core.telegram.org/bots/api#sendvideonote
1262
1256
  '''
@@ -1266,8 +1260,7 @@ class Methods(core.BaseBot):
1266
1260
  'chat_id': chat_id,
1267
1261
  'message_thread_id': message_thread_id,
1268
1262
  'direct_messages_topic_id': direct_messages_topic_id,
1269
- 'receiver_user_id': receiver_user_id,
1270
- 'callback_query_id': callback_query_id,
1263
+ 'ephemeral_message_parameters': ephemeral_message_parameters,
1271
1264
  'video_note': video_note,
1272
1265
  'duration': duration,
1273
1266
  'length': length,
@@ -1376,8 +1369,7 @@ class Methods(core.BaseBot):
1376
1369
  business_connection_id: Optional[str] = None,
1377
1370
  message_thread_id: Optional[int] = None,
1378
1371
  direct_messages_topic_id: Optional[int] = None,
1379
- receiver_user_id: Optional[int] = None,
1380
- callback_query_id: Optional[str] = None,
1372
+ ephemeral_message_parameters: Optional[EphemeralMessageParameters] = None,
1381
1373
  horizontal_accuracy: Optional[float] = None,
1382
1374
  live_period: Optional[int] = None,
1383
1375
  heading: Optional[int] = None,
@@ -1402,8 +1394,7 @@ class Methods(core.BaseBot):
1402
1394
  'chat_id': chat_id,
1403
1395
  'message_thread_id': message_thread_id,
1404
1396
  'direct_messages_topic_id': direct_messages_topic_id,
1405
- 'receiver_user_id': receiver_user_id,
1406
- 'callback_query_id': callback_query_id,
1397
+ 'ephemeral_message_parameters': ephemeral_message_parameters,
1407
1398
  'latitude': latitude,
1408
1399
  'longitude': longitude,
1409
1400
  'horizontal_accuracy': horizontal_accuracy,
@@ -1430,8 +1421,7 @@ class Methods(core.BaseBot):
1430
1421
  business_connection_id: Optional[str] = None,
1431
1422
  message_thread_id: Optional[int] = None,
1432
1423
  direct_messages_topic_id: Optional[int] = None,
1433
- receiver_user_id: Optional[int] = None,
1434
- callback_query_id: Optional[str] = None,
1424
+ ephemeral_message_parameters: Optional[EphemeralMessageParameters] = None,
1435
1425
  foursquare_id: Optional[str] = None,
1436
1426
  foursquare_type: Optional[str] = None,
1437
1427
  google_place_id: Optional[str] = None,
@@ -1456,8 +1446,7 @@ class Methods(core.BaseBot):
1456
1446
  'chat_id': chat_id,
1457
1447
  'message_thread_id': message_thread_id,
1458
1448
  'direct_messages_topic_id': direct_messages_topic_id,
1459
- 'receiver_user_id': receiver_user_id,
1460
- 'callback_query_id': callback_query_id,
1449
+ 'ephemeral_message_parameters': ephemeral_message_parameters,
1461
1450
  'latitude': latitude,
1462
1451
  'longitude': longitude,
1463
1452
  'title': title,
@@ -1484,8 +1473,7 @@ class Methods(core.BaseBot):
1484
1473
  business_connection_id: Optional[str] = None,
1485
1474
  message_thread_id: Optional[int] = None,
1486
1475
  direct_messages_topic_id: Optional[int] = None,
1487
- receiver_user_id: Optional[int] = None,
1488
- callback_query_id: Optional[str] = None,
1476
+ ephemeral_message_parameters: Optional[EphemeralMessageParameters] = None,
1489
1477
  last_name: Optional[str] = None,
1490
1478
  vcard: Optional[str] = None,
1491
1479
  disable_notification: Optional[bool] = None,
@@ -1508,8 +1496,7 @@ class Methods(core.BaseBot):
1508
1496
  'chat_id': chat_id,
1509
1497
  'message_thread_id': message_thread_id,
1510
1498
  'direct_messages_topic_id': direct_messages_topic_id,
1511
- 'receiver_user_id': receiver_user_id,
1512
- 'callback_query_id': callback_query_id,
1499
+ 'ephemeral_message_parameters': ephemeral_message_parameters,
1513
1500
  'phone_number': phone_number,
1514
1501
  'first_name': first_name,
1515
1502
  'last_name': last_name,
@@ -1684,6 +1671,8 @@ class Methods(core.BaseBot):
1684
1671
  text: Optional[str] = None,
1685
1672
  parse_mode: Optional[Union[str, enums.ParseMode]] = None,
1686
1673
  entities: Optional[List[MessageEntity]] = None,
1674
+ can_stop: Optional[bool] = None,
1675
+ keep_on_stop: Optional[bool] = None,
1687
1676
  ) -> bool:
1688
1677
  '''
1689
1678
  Use this method to stream a partial message
@@ -1704,6 +1693,8 @@ class Methods(core.BaseBot):
1704
1693
  'text': text,
1705
1694
  'parse_mode': parse_mode,
1706
1695
  'entities': entities,
1696
+ 'can_stop': can_stop,
1697
+ 'keep_on_stop': keep_on_stop,
1707
1698
  })
1708
1699
  return BoolAdapter.validate_python(response)
1709
1700
 
@@ -1957,6 +1948,7 @@ class Methods(core.BaseBot):
1957
1948
  can_manage_topics: Optional[bool] = None,
1958
1949
  can_manage_direct_messages: Optional[bool] = None,
1959
1950
  can_manage_tags: Optional[bool] = None,
1951
+ can_send_welcome_messages: Optional[bool] = None,
1960
1952
  ) -> bool:
1961
1953
  '''
1962
1954
  Use this method to promote or demote a
@@ -1990,6 +1982,7 @@ class Methods(core.BaseBot):
1990
1982
  'can_manage_topics': can_manage_topics,
1991
1983
  'can_manage_direct_messages': can_manage_direct_messages,
1992
1984
  'can_manage_tags': can_manage_tags,
1985
+ 'can_send_welcome_messages': can_send_welcome_messages,
1993
1986
  })
1994
1987
  return BoolAdapter.validate_python(response)
1995
1988
 
@@ -4345,18 +4338,19 @@ class Methods(core.BaseBot):
4345
4338
  chat_id: Union[int, str],
4346
4339
  receiver_user_id: int,
4347
4340
  ephemeral_message_id: int,
4348
- text: str,
4341
+ text: Optional[str] = None,
4349
4342
  parse_mode: Optional[Union[str, enums.ParseMode]] = None,
4350
4343
  entities: Optional[List[MessageEntity]] = None,
4344
+ rich_message: Optional[InputRichMessage] = None,
4351
4345
  link_preview_options: Optional[LinkPreviewOptions] = None,
4352
4346
  reply_markup: Optional[InlineKeyboardMarkup] = None,
4353
4347
  ) -> bool:
4354
4348
  '''
4355
4349
  Use this method to edit an ephemeral text
4356
- message. Note that it is not guaranteed that
4357
- the user will receive the message edit event,
4358
- especially if they are offline. On success, True
4359
- is returned.
4350
+ or rich message. Note that it is not
4351
+ guaranteed that the user will receive the message
4352
+ edit event, especially if they are offline. On
4353
+ success, True is returned.
4360
4354
 
4361
4355
  Reference: https://core.telegram.org/bots/api#editephemeralmessagetext
4362
4356
  '''
@@ -4368,6 +4362,7 @@ class Methods(core.BaseBot):
4368
4362
  'text': text,
4369
4363
  'parse_mode': parse_mode,
4370
4364
  'entities': entities,
4365
+ 'rich_message': rich_message,
4371
4366
  'link_preview_options': link_preview_options,
4372
4367
  'reply_markup': reply_markup,
4373
4368
  })
@@ -4408,6 +4403,7 @@ class Methods(core.BaseBot):
4408
4403
  caption: Optional[str] = None,
4409
4404
  parse_mode: Optional[Union[str, enums.ParseMode]] = None,
4410
4405
  caption_entities: Optional[List[MessageEntity]] = None,
4406
+ show_caption_above_media: Optional[bool] = None,
4411
4407
  reply_markup: Optional[InlineKeyboardMarkup] = None,
4412
4408
  ) -> bool:
4413
4409
  '''
@@ -4427,6 +4423,7 @@ class Methods(core.BaseBot):
4427
4423
  'caption': caption,
4428
4424
  'parse_mode': parse_mode,
4429
4425
  'caption_entities': caption_entities,
4426
+ 'show_caption_above_media': show_caption_above_media,
4430
4427
  'reply_markup': reply_markup,
4431
4428
  })
4432
4429
  return BoolAdapter.validate_python(response)
@@ -4630,8 +4627,7 @@ class Methods(core.BaseBot):
4630
4627
  business_connection_id: Optional[str] = None,
4631
4628
  message_thread_id: Optional[int] = None,
4632
4629
  direct_messages_topic_id: Optional[int] = None,
4633
- receiver_user_id: Optional[int] = None,
4634
- callback_query_id: Optional[str] = None,
4630
+ ephemeral_message_parameters: Optional[EphemeralMessageParameters] = None,
4635
4631
  emoji: Optional[str] = None,
4636
4632
  disable_notification: Optional[bool] = None,
4637
4633
  protect_content: Optional[bool] = None,
@@ -4654,8 +4650,7 @@ class Methods(core.BaseBot):
4654
4650
  'chat_id': chat_id,
4655
4651
  'message_thread_id': message_thread_id,
4656
4652
  'direct_messages_topic_id': direct_messages_topic_id,
4657
- 'receiver_user_id': receiver_user_id,
4658
- 'callback_query_id': callback_query_id,
4653
+ 'ephemeral_message_parameters': ephemeral_message_parameters,
4659
4654
  'sticker': sticker,
4660
4655
  'emoji': emoji,
4661
4656
  'disable_notification': disable_notification,
@@ -4982,6 +4977,7 @@ class Methods(core.BaseBot):
4982
4977
  business_connection_id: Optional[str] = None,
4983
4978
  message_thread_id: Optional[int] = None,
4984
4979
  direct_messages_topic_id: Optional[int] = None,
4980
+ ephemeral_message_parameters: Optional[EphemeralMessageParameters] = None,
4985
4981
  disable_notification: Optional[bool] = None,
4986
4982
  protect_content: Optional[bool] = None,
4987
4983
  allow_paid_broadcast: Optional[bool] = None,
@@ -5005,6 +5001,7 @@ class Methods(core.BaseBot):
5005
5001
  'chat_id': chat_id,
5006
5002
  'message_thread_id': message_thread_id,
5007
5003
  'direct_messages_topic_id': direct_messages_topic_id,
5004
+ 'ephemeral_message_parameters': ephemeral_message_parameters,
5008
5005
  'rich_message': rich_message,
5009
5006
  'disable_notification': disable_notification,
5010
5007
  'protect_content': protect_content,
@@ -5022,6 +5019,8 @@ class Methods(core.BaseBot):
5022
5019
  draft_id: int,
5023
5020
  rich_message: InputRichMessage,
5024
5021
  message_thread_id: Optional[int] = None,
5022
+ can_stop: Optional[bool] = None,
5023
+ keep_on_stop: Optional[bool] = None,
5025
5024
  ) -> bool:
5026
5025
  '''
5027
5026
  Use this method to stream a partial rich
@@ -5041,6 +5040,8 @@ class Methods(core.BaseBot):
5041
5040
  'message_thread_id': message_thread_id,
5042
5041
  'draft_id': draft_id,
5043
5042
  'rich_message': rich_message,
5043
+ 'can_stop': can_stop,
5044
+ 'keep_on_stop': keep_on_stop,
5044
5045
  })
5045
5046
  return BoolAdapter.validate_python(response)
5046
5047
 
@@ -119,6 +119,7 @@ class Message(MaybeInaccessibleMessage):
119
119
  checklist_tasks_done: Optional[ChecklistTasksDone] = Field(default=None)
120
120
  checklist_tasks_added: Optional[ChecklistTasksAdded] = Field(default=None)
121
121
  community_chat_added: Optional[CommunityChatAdded] = Field(default=None)
122
+ community_chat_joined: Optional[CommunityChatJoined] = Field(default=None)
122
123
  community_chat_removed: Optional[CommunityChatRemoved] = Field(default=None)
123
124
  direct_message_price_changed: Optional[DirectMessagePriceChanged] = Field(default=None)
124
125
  forum_topic_created: Optional[ForumTopicCreated] = Field(default=None)
@@ -426,7 +427,7 @@ class InaccessibleMessage(MaybeInaccessibleMessage):
426
427
  message_id: int
427
428
  date: int
428
429
 
429
- _MaybeInaccessibleMessage = Union[
430
+ type _MaybeInaccessibleMessage = Union[
430
431
  Message,
431
432
  InaccessibleMessage,
432
433
  ]
@@ -487,7 +488,7 @@ class MessageOriginChannel(MessageOrigin):
487
488
  message_id: int
488
489
  author_signature: Optional[str] = Field(default=None)
489
490
 
490
- _MessageOrigin = Union[
491
+ type _MessageOrigin = Union[
491
492
  MessageOriginUser,
492
493
  MessageOriginHiddenUser,
493
494
  MessageOriginChat,
@@ -540,7 +541,7 @@ class PaidMediaVideo(PaidMedia):
540
541
  type: Literal['video'] = 'video' # pyright: ignore[reportIncompatibleVariableOverride]
541
542
  video: Video
542
543
 
543
- _PaidMedia = Union[
544
+ type _PaidMedia = Union[
544
545
  PaidMediaLivePhoto,
545
546
  PaidMediaPhoto,
546
547
  PaidMediaPreview,
@@ -686,7 +687,7 @@ class InputMediaVideo(InputPollMedia):
686
687
  supports_streaming: Optional[bool] = Field(default=None)
687
688
  has_spoiler: Optional[bool] = Field(default=None)
688
689
 
689
- _InputPollMedia = Union[
690
+ type _InputPollMedia = Union[
690
691
  InputMediaAnimation,
691
692
  InputMediaAudio,
692
693
  InputMediaDocument,
@@ -722,7 +723,7 @@ class InputMediaSticker(InputPollOptionMedia):
722
723
  media: Union[InputFile, str]
723
724
  emoji: Optional[str] = Field(default=None)
724
725
 
725
- _InputPollOptionMedia = Union[
726
+ type _InputPollOptionMedia = Union[
726
727
  InputMediaAnimation,
727
728
  InputMediaLink,
728
729
  InputMediaLivePhoto,
@@ -770,7 +771,7 @@ class BackgroundFillFreeformGradient(BackgroundFill):
770
771
  type: Literal['freeform_gradient'] = 'freeform_gradient' # pyright: ignore[reportIncompatibleVariableOverride]
771
772
  colors: List[int]
772
773
 
773
- _BackgroundFill = Union[
774
+ type _BackgroundFill = Union[
774
775
  BackgroundFillSolid,
775
776
  BackgroundFillGradient,
776
777
  BackgroundFillFreeformGradient,
@@ -834,7 +835,7 @@ class BackgroundTypeChatTheme(BackgroundType):
834
835
  type: Literal['chat_theme'] = 'chat_theme' # pyright: ignore[reportIncompatibleVariableOverride]
835
836
  theme_name: str
836
837
 
837
- _BackgroundType = Union[
838
+ type _BackgroundType = Union[
838
839
  BackgroundTypeFill,
839
840
  BackgroundTypeWallpaper,
840
841
  BackgroundTypePattern,
@@ -1011,6 +1012,7 @@ class ChatMemberAdministrator(ChatMember):
1011
1012
  can_post_stories: bool
1012
1013
  can_edit_stories: bool
1013
1014
  can_delete_stories: bool
1015
+ can_send_welcome_messages: bool
1014
1016
  can_post_messages: Optional[bool] = Field(default=None)
1015
1017
  can_edit_messages: Optional[bool] = Field(default=None)
1016
1018
  can_pin_messages: Optional[bool] = Field(default=None)
@@ -1087,7 +1089,7 @@ class ChatMemberBanned(ChatMember):
1087
1089
  user: User
1088
1090
  until_date: int
1089
1091
 
1090
- _ChatMember = Union[
1092
+ type _ChatMember = Union[
1091
1093
  ChatMemberOwner,
1092
1094
  ChatMemberAdministrator,
1093
1095
  ChatMemberMember,
@@ -1166,7 +1168,7 @@ class StoryAreaTypeUniqueGift(StoryAreaType):
1166
1168
  type: Literal['unique_gift'] = 'unique_gift' # pyright: ignore[reportIncompatibleVariableOverride]
1167
1169
  name: str
1168
1170
 
1169
- _StoryAreaType = Union[
1171
+ type _StoryAreaType = Union[
1170
1172
  StoryAreaTypeLocation,
1171
1173
  StoryAreaTypeSuggestedReaction,
1172
1174
  StoryAreaTypeLink,
@@ -1207,7 +1209,7 @@ class ReactionTypePaid(ReactionType):
1207
1209
 
1208
1210
  type: Literal['paid'] = 'paid' # pyright: ignore[reportIncompatibleVariableOverride]
1209
1211
 
1210
- _ReactionType = Union[
1212
+ type _ReactionType = Union[
1211
1213
  ReactionTypeEmoji,
1212
1214
  ReactionTypeCustomEmoji,
1213
1215
  ReactionTypePaid,
@@ -1263,7 +1265,7 @@ class OwnedGiftUnique(OwnedGift):
1263
1265
  transfer_star_count: Optional[int] = Field(default=None)
1264
1266
  next_transfer_date: Optional[int] = Field(default=None)
1265
1267
 
1266
- _OwnedGift = Union[
1268
+ type _OwnedGift = Union[
1267
1269
  OwnedGiftRegular,
1268
1270
  OwnedGiftUnique,
1269
1271
  ]
@@ -1347,7 +1349,7 @@ class BotCommandScopeChatMember(BotCommandScope):
1347
1349
  chat_id: Union[int, str]
1348
1350
  user_id: int
1349
1351
 
1350
- _BotCommandScope = Union[
1352
+ type _BotCommandScope = Union[
1351
1353
  BotCommandScopeDefault,
1352
1354
  BotCommandScopeAllPrivateChats,
1353
1355
  BotCommandScopeAllGroupChats,
@@ -1393,7 +1395,7 @@ class MenuButtonDefault(MenuButton):
1393
1395
 
1394
1396
  type: Literal['default'] = 'default' # pyright: ignore[reportIncompatibleVariableOverride]
1395
1397
 
1396
- _MenuButton = Union[
1398
+ type _MenuButton = Union[
1397
1399
  MenuButtonCommands,
1398
1400
  MenuButtonWebApp,
1399
1401
  MenuButtonDefault,
@@ -1447,7 +1449,7 @@ class ChatBoostSourceGiveaway(ChatBoostSource):
1447
1449
  prize_star_count: Optional[int] = Field(default=None)
1448
1450
  is_unclaimed: Optional[bool] = Field(default=None)
1449
1451
 
1450
- _ChatBoostSource = Union[
1452
+ type _ChatBoostSource = Union[
1451
1453
  ChatBoostSourcePremium,
1452
1454
  ChatBoostSourceGiftCode,
1453
1455
  ChatBoostSourceGiveaway,
@@ -1461,7 +1463,7 @@ class InputMedia(BaseModel):
1461
1463
  parse_mode: Optional[str] = Field(default=None)
1462
1464
  caption_entities: Optional[List[MessageEntity]] = Field(default=None)
1463
1465
 
1464
- _InputMedia = Union[
1466
+ type _InputMedia = Union[
1465
1467
  InputMediaAnimation,
1466
1468
  InputMediaAudio,
1467
1469
  InputMediaDocument,
@@ -1514,7 +1516,7 @@ class InputPaidMediaVideo(InputPaidMedia):
1514
1516
  duration: Optional[int] = Field(default=None)
1515
1517
  supports_streaming: Optional[bool] = Field(default=None)
1516
1518
 
1517
- _InputPaidMedia = Union[
1519
+ type _InputPaidMedia = Union[
1518
1520
  InputPaidMediaLivePhoto,
1519
1521
  InputPaidMediaPhoto,
1520
1522
  InputPaidMediaVideo,
@@ -1545,7 +1547,7 @@ class InputProfilePhotoAnimated(InputProfilePhoto):
1545
1547
  animation: Union[InputFile, str]
1546
1548
  main_frame_timestamp: Optional[float] = Field(default=None)
1547
1549
 
1548
- _InputProfilePhoto = Union[
1550
+ type _InputProfilePhoto = Union[
1549
1551
  InputProfilePhotoStatic,
1550
1552
  InputProfilePhotoAnimated,
1551
1553
  ]
@@ -1577,14 +1579,14 @@ class InputStoryContentVideo(InputStoryContent):
1577
1579
  cover_frame_timestamp: Optional[float] = Field(default=None)
1578
1580
  is_animation: Optional[bool] = Field(default=None)
1579
1581
 
1580
- _InputStoryContent = Union[
1582
+ type _InputStoryContent = Union[
1581
1583
  InputStoryContentPhoto,
1582
1584
  InputStoryContentVideo,
1583
1585
  ]
1584
1586
  InputStoryContentAdapter = TypeAdapter[_InputStoryContent](_InputStoryContent)
1585
1587
 
1586
1588
  class RichText(BaseModel):
1587
- type: Literal['bold', 'italic', 'underline', 'strikethrough', 'spoiler', 'date_time', 'text_mention', 'subscript', 'superscript', 'marked', 'code', 'custom_emoji', 'mathematical_expression', 'url', 'email_address', 'phone_number', 'bank_card_number', 'mention', 'hashtag', 'cashtag', 'bot_command', 'anchor', 'anchor_link', 'reference', 'reference_link']
1589
+ type: Literal['bold', 'italic', 'underline', 'strikethrough', 'spoiler', 'date_time', 'text_mention', 'subscript', 'superscript', 'marked', 'code', 'custom_emoji', 'mathematical_expression', 'url', 'email_address', 'phone_number', 'bank_card_number', 'mention', 'hashtag', 'cashtag', 'bot_command', 'button', 'anchor', 'anchor_link', 'reference', 'reference_link']
1588
1590
 
1589
1591
  class RichTextBold(RichText):
1590
1592
  '''
@@ -1809,6 +1811,16 @@ class RichTextBotCommand(RichText):
1809
1811
  text: _RichText
1810
1812
  bot_command: str
1811
1813
 
1814
+ class RichTextButton(RichText):
1815
+ '''
1816
+ A button.
1817
+
1818
+ Reference: https://core.telegram.org/bots/api#richtextbutton
1819
+ '''
1820
+
1821
+ type: Literal['button'] = 'button' # pyright: ignore[reportIncompatibleVariableOverride]
1822
+ button: RichMessageButton
1823
+
1812
1824
  class RichTextAnchor(RichText):
1813
1825
  '''
1814
1826
  An anchor.
@@ -1852,7 +1864,7 @@ class RichTextReferenceLink(RichText):
1852
1864
  text: _RichText
1853
1865
  reference_name: str
1854
1866
 
1855
- _RichText = Union[
1867
+ type _RichText = Union[
1856
1868
  RichTextBold,
1857
1869
  RichTextItalic,
1858
1870
  RichTextUnderline,
@@ -1874,15 +1886,18 @@ _RichText = Union[
1874
1886
  RichTextHashtag,
1875
1887
  RichTextCashtag,
1876
1888
  RichTextBotCommand,
1889
+ RichTextButton,
1877
1890
  RichTextAnchor,
1878
1891
  RichTextAnchorLink,
1879
1892
  RichTextReference,
1880
1893
  RichTextReferenceLink,
1894
+ str,
1895
+ List[_RichText],
1881
1896
  ]
1882
1897
  RichTextAdapter = TypeAdapter[_RichText](_RichText)
1883
1898
 
1884
1899
  class RichBlock(BaseModel):
1885
- type: Literal['paragraph', 'heading', 'pre', 'footer', 'divider', 'mathematical_expression', 'anchor', 'list', 'blockquote', 'pullquote', 'collage', 'slideshow', 'table', 'details', 'map', 'animation', 'audio', 'photo', 'video', 'voice_note', 'thinking']
1900
+ type: Literal['paragraph', 'heading', 'pre', 'footer', 'divider', 'mathematical_expression', 'anchor', 'list', 'blockquote', 'expandable_blockquote', 'pullquote', 'collage', 'slideshow', 'table', 'details', 'map', 'buttons', 'animation', 'audio', 'document', 'photo', 'video', 'voice_note', 'thinking']
1886
1901
 
1887
1902
  class RichBlockParagraph(RichBlock):
1888
1903
  '''
@@ -1984,6 +1999,18 @@ class RichBlockBlockQuotation(RichBlock):
1984
1999
  blocks: List[_RichBlock]
1985
2000
  credit: Optional[_RichText] = Field(default=None)
1986
2001
 
2002
+ class RichBlockExpandableBlockQuotation(RichBlock):
2003
+ '''
2004
+ A block quotation, corresponding to the HTML tag
2005
+ <blockquote> with custom attribute "expandable".
2006
+
2007
+ Reference: https://core.telegram.org/bots/api#richblockexpandableblockquotation
2008
+ '''
2009
+
2010
+ type: Literal['expandable_blockquote'] = 'expandable_blockquote' # pyright: ignore[reportIncompatibleVariableOverride]
2011
+ text: _RichText
2012
+ credit: Optional[_RichText] = Field(default=None)
2013
+
1987
2014
  class RichBlockPullQuotation(RichBlock):
1988
2015
  '''
1989
2016
  A quotation with centered text, loosely corresponding to
@@ -2031,6 +2058,7 @@ class RichBlockTable(RichBlock):
2031
2058
  cells: List[List[RichBlockTableCell]]
2032
2059
  is_bordered: Optional[bool] = Field(default=None)
2033
2060
  is_striped: Optional[bool] = Field(default=None)
2061
+ is_compact: Optional[bool] = Field(default=None)
2034
2062
  caption: Optional[_RichText] = Field(default=None)
2035
2063
 
2036
2064
  class RichBlockDetails(RichBlock):
@@ -2061,6 +2089,19 @@ class RichBlockMap(RichBlock):
2061
2089
  height: int
2062
2090
  caption: Optional[RichBlockCaption] = Field(default=None)
2063
2091
 
2092
+ class RichBlockButtons(RichBlock):
2093
+ '''
2094
+ A block containing a list of buttons that
2095
+ are shown in one row, corresponding to the
2096
+ custom HTML tag <tg-button-row>.
2097
+
2098
+ Reference: https://core.telegram.org/bots/api#richblockbuttons
2099
+ '''
2100
+
2101
+ type: Literal['buttons'] = 'buttons' # pyright: ignore[reportIncompatibleVariableOverride]
2102
+ buttons: List[RichMessageButton]
2103
+ align: Optional[str] = Field(default=None)
2104
+
2064
2105
  class RichBlockAnimation(RichBlock):
2065
2106
  '''
2066
2107
  A block with an animation, corresponding to the
@@ -2086,6 +2127,18 @@ class RichBlockAudio(RichBlock):
2086
2127
  audio: Audio
2087
2128
  caption: Optional[RichBlockCaption] = Field(default=None)
2088
2129
 
2130
+ class RichBlockDocument(RichBlock):
2131
+ '''
2132
+ A block with a general file, corresponding to
2133
+ the custom HTML tag <tg-document>.
2134
+
2135
+ Reference: https://core.telegram.org/bots/api#richblockdocument
2136
+ '''
2137
+
2138
+ type: Literal['document'] = 'document' # pyright: ignore[reportIncompatibleVariableOverride]
2139
+ document: Document
2140
+ caption: Optional[RichBlockCaption] = Field(default=None)
2141
+
2089
2142
  class RichBlockPhoto(RichBlock):
2090
2143
  '''
2091
2144
  A block with a photo, corresponding to the
@@ -2139,7 +2192,7 @@ class RichBlockThinking(RichBlock):
2139
2192
  type: Literal['thinking'] = 'thinking' # pyright: ignore[reportIncompatibleVariableOverride]
2140
2193
  text: _RichText
2141
2194
 
2142
- _RichBlock = Union[
2195
+ type _RichBlock = Union[
2143
2196
  RichBlockParagraph,
2144
2197
  RichBlockSectionHeading,
2145
2198
  RichBlockPreformatted,
@@ -2149,14 +2202,17 @@ _RichBlock = Union[
2149
2202
  RichBlockAnchor,
2150
2203
  RichBlockList,
2151
2204
  RichBlockBlockQuotation,
2205
+ RichBlockExpandableBlockQuotation,
2152
2206
  RichBlockPullQuotation,
2153
2207
  RichBlockCollage,
2154
2208
  RichBlockSlideshow,
2155
2209
  RichBlockTable,
2156
2210
  RichBlockDetails,
2157
2211
  RichBlockMap,
2212
+ RichBlockButtons,
2158
2213
  RichBlockAnimation,
2159
2214
  RichBlockAudio,
2215
+ RichBlockDocument,
2160
2216
  RichBlockPhoto,
2161
2217
  RichBlockVideo,
2162
2218
  RichBlockVoiceNote,
@@ -2165,7 +2221,7 @@ _RichBlock = Union[
2165
2221
  RichBlockAdapter = TypeAdapter[_RichBlock](_RichBlock)
2166
2222
 
2167
2223
  class InputRichBlock(BaseModel):
2168
- type: Literal['paragraph', 'heading', 'pre', 'footer', 'divider', 'mathematical_expression', 'anchor', 'list', 'blockquote', 'pullquote', 'collage', 'slideshow', 'table', 'details', 'map', 'animation', 'audio', 'photo', 'video', 'voice_note', 'thinking']
2224
+ type: Literal['paragraph', 'heading', 'pre', 'footer', 'divider', 'mathematical_expression', 'anchor', 'list', 'blockquote', 'expandable_blockquote', 'pullquote', 'collage', 'slideshow', 'table', 'details', 'map', 'buttons', 'animation', 'audio', 'document', 'photo', 'video', 'voice_note', 'thinking']
2169
2225
 
2170
2226
  class InputRichBlockParagraph(InputRichBlock):
2171
2227
  '''
@@ -2267,6 +2323,18 @@ class InputRichBlockBlockQuotation(InputRichBlock):
2267
2323
  blocks: List[_InputRichBlock]
2268
2324
  credit: Optional[_RichText] = Field(default=None)
2269
2325
 
2326
+ class InputRichBlockExpandableBlockQuotation(InputRichBlock):
2327
+ '''
2328
+ A block quotation, corresponding to the HTML tag
2329
+ <blockquote> with custom attribute "expandable".
2330
+
2331
+ Reference: https://core.telegram.org/bots/api#inputrichblockexpandableblockquotation
2332
+ '''
2333
+
2334
+ type: Literal['expandable_blockquote'] = 'expandable_blockquote' # pyright: ignore[reportIncompatibleVariableOverride]
2335
+ text: _RichText
2336
+ credit: Optional[_RichText] = Field(default=None)
2337
+
2270
2338
  class InputRichBlockPullQuotation(InputRichBlock):
2271
2339
  '''
2272
2340
  A quotation with centered text, loosely corresponding to
@@ -2314,6 +2382,7 @@ class InputRichBlockTable(InputRichBlock):
2314
2382
  cells: List[List[RichBlockTableCell]]
2315
2383
  is_bordered: Optional[bool] = Field(default=None)
2316
2384
  is_striped: Optional[bool] = Field(default=None)
2385
+ is_compact: Optional[bool] = Field(default=None)
2317
2386
  caption: Optional[_RichText] = Field(default=None)
2318
2387
 
2319
2388
  class InputRichBlockDetails(InputRichBlock):
@@ -2342,11 +2411,24 @@ class InputRichBlockMap(InputRichBlock):
2342
2411
 
2343
2412
  type: Literal['map'] = 'map' # pyright: ignore[reportIncompatibleVariableOverride]
2344
2413
  location: Location
2345
- zoom: int
2346
- width: int
2347
- height: int
2414
+ zoom: Optional[int] = Field(default=None)
2415
+ width: Optional[int] = Field(default=None)
2416
+ height: Optional[int] = Field(default=None)
2348
2417
  caption: Optional[RichBlockCaption] = Field(default=None)
2349
2418
 
2419
+ class InputRichBlockButtons(InputRichBlock):
2420
+ '''
2421
+ A block containing a list of buttons that
2422
+ are shown in one row, corresponding to the
2423
+ custom HTML tag <tg-button-row>.
2424
+
2425
+ Reference: https://core.telegram.org/bots/api#inputrichblockbuttons
2426
+ '''
2427
+
2428
+ type: Literal['buttons'] = 'buttons' # pyright: ignore[reportIncompatibleVariableOverride]
2429
+ buttons: List[RichMessageButton]
2430
+ align: Optional[str] = Field(default=None)
2431
+
2350
2432
  class InputRichBlockAnimation(InputRichBlock):
2351
2433
  '''
2352
2434
  A block with an animation, corresponding to the
@@ -2371,6 +2453,18 @@ class InputRichBlockAudio(InputRichBlock):
2371
2453
  audio: InputMediaAudio
2372
2454
  caption: Optional[RichBlockCaption] = Field(default=None)
2373
2455
 
2456
+ class InputRichBlockDocument(InputRichBlock):
2457
+ '''
2458
+ A block with a general file, corresponding to
2459
+ the custom HTML tag <tg-document>.
2460
+
2461
+ Reference: https://core.telegram.org/bots/api#inputrichblockdocument
2462
+ '''
2463
+
2464
+ type: Literal['document'] = 'document' # pyright: ignore[reportIncompatibleVariableOverride]
2465
+ document: InputMediaDocument
2466
+ caption: Optional[RichBlockCaption] = Field(default=None)
2467
+
2374
2468
  class InputRichBlockPhoto(InputRichBlock):
2375
2469
  '''
2376
2470
  A block with a photo, corresponding to the
@@ -2422,7 +2516,7 @@ class InputRichBlockThinking(InputRichBlock):
2422
2516
  type: Literal['thinking'] = 'thinking' # pyright: ignore[reportIncompatibleVariableOverride]
2423
2517
  text: _RichText
2424
2518
 
2425
- _InputRichBlock = Union[
2519
+ type _InputRichBlock = Union[
2426
2520
  InputRichBlockParagraph,
2427
2521
  InputRichBlockSectionHeading,
2428
2522
  InputRichBlockPreformatted,
@@ -2432,14 +2526,17 @@ _InputRichBlock = Union[
2432
2526
  InputRichBlockAnchor,
2433
2527
  InputRichBlockList,
2434
2528
  InputRichBlockBlockQuotation,
2529
+ InputRichBlockExpandableBlockQuotation,
2435
2530
  InputRichBlockPullQuotation,
2436
2531
  InputRichBlockCollage,
2437
2532
  InputRichBlockSlideshow,
2438
2533
  InputRichBlockTable,
2439
2534
  InputRichBlockDetails,
2440
2535
  InputRichBlockMap,
2536
+ InputRichBlockButtons,
2441
2537
  InputRichBlockAnimation,
2442
2538
  InputRichBlockAudio,
2539
+ InputRichBlockDocument,
2443
2540
  InputRichBlockPhoto,
2444
2541
  InputRichBlockVideo,
2445
2542
  InputRichBlockVoiceNote,
@@ -2920,7 +3017,7 @@ class InlineQueryResultVoice(InlineQueryResult):
2920
3017
  reply_markup: Optional[InlineKeyboardMarkup] = Field(default=None)
2921
3018
  input_message_content: Optional[_InputMessageContent] = Field(default=None)
2922
3019
 
2923
- _InlineQueryResult = Union[
3020
+ type _InlineQueryResult = Union[
2924
3021
  InlineQueryResultCachedAudio,
2925
3022
  InlineQueryResultCachedDocument,
2926
3023
  InlineQueryResultCachedGif,
@@ -3050,7 +3147,7 @@ class InputInvoiceMessageContent(InputMessageContent):
3050
3147
  send_email_to_provider: Optional[bool] = Field(default=None)
3051
3148
  is_flexible: Optional[bool] = Field(default=None)
3052
3149
 
3053
- _InputMessageContent = Union[
3150
+ type _InputMessageContent = Union[
3054
3151
  InputTextMessageContent,
3055
3152
  InputRichMessageContent,
3056
3153
  InputLocationMessageContent,
@@ -3092,7 +3189,7 @@ class RevenueWithdrawalStateFailed(RevenueWithdrawalState):
3092
3189
 
3093
3190
  type: Literal['failed'] = 'failed' # pyright: ignore[reportIncompatibleVariableOverride]
3094
3191
 
3095
- _RevenueWithdrawalState = Union[
3192
+ type _RevenueWithdrawalState = Union[
3096
3193
  RevenueWithdrawalStatePending,
3097
3194
  RevenueWithdrawalStateSucceeded,
3098
3195
  RevenueWithdrawalStateFailed,
@@ -3183,7 +3280,7 @@ class TransactionPartnerOther(TransactionPartner):
3183
3280
 
3184
3281
  type: Literal['other'] = 'other' # pyright: ignore[reportIncompatibleVariableOverride]
3185
3282
 
3186
- _TransactionPartner = Union[
3283
+ type _TransactionPartner = Union[
3187
3284
  TransactionPartnerUser,
3188
3285
  TransactionPartnerChat,
3189
3286
  TransactionPartnerAffiliateProgram,
@@ -3329,7 +3426,7 @@ class PassportElementErrorUnspecified(PassportElementError):
3329
3426
  element_hash: str
3330
3427
  message: str
3331
3428
 
3332
- _PassportElementError = Union[
3429
+ type _PassportElementError = Union[
3333
3430
  PassportElementErrorDataField,
3334
3431
  PassportElementErrorFrontSide,
3335
3432
  PassportElementErrorReverseSide,
@@ -3378,6 +3475,7 @@ class Update(BaseModel):
3378
3475
  removed_chat_boost: Optional[ChatBoostRemoved] = Field(default=None)
3379
3476
  managed_bot: Optional[ManagedBotUpdated] = Field(default=None)
3380
3477
  subscription: Optional[BotSubscriptionUpdated] = Field(default=None)
3478
+ stopped_message_generation: Optional[MessageGenerationStopped] = Field(default=None)
3381
3479
 
3382
3480
  @staticmethod
3383
3481
  def from_dict(
@@ -3624,6 +3722,18 @@ class ReplyParameters(BaseModel):
3624
3722
  checklist_task_id: Optional[int] = Field(default=None)
3625
3723
  poll_option_id: Optional[str] = Field(default=None)
3626
3724
 
3725
+ class EphemeralMessageParameters(BaseModel):
3726
+ '''
3727
+ This object describes the origin of a message.
3728
+ It can be one of
3729
+
3730
+ Reference: https://core.telegram.org/bots/api#ephemeralmessageparameters
3731
+ '''
3732
+
3733
+ receiver_user_id: int
3734
+ callback_query_id: Optional[str] = Field(default=None)
3735
+ replace_callback_query_message: Optional[bool] = Field(default=None)
3736
+
3627
3737
  class PhotoSize(BaseModel):
3628
3738
  '''
3629
3739
  This object represents one size of a photo
@@ -3752,8 +3862,7 @@ class Video(BaseModel):
3752
3862
 
3753
3863
  class VideoNote(BaseModel):
3754
3864
  '''
3755
- This object represents a video message (available in
3756
- Telegram apps as of v.4.0).
3865
+ This object represents a video message.
3757
3866
 
3758
3867
  Reference: https://core.telegram.org/bots/api#videonote
3759
3868
  '''
@@ -4064,6 +4173,18 @@ class BotSubscriptionUpdated(BaseModel):
4064
4173
  invoice_payload: str
4065
4174
  state: str
4066
4175
 
4176
+ class MessageGenerationStopped(BaseModel):
4177
+ '''
4178
+ This object describes an update about a user
4179
+ stopping message generation.
4180
+
4181
+ Reference: https://core.telegram.org/bots/api#messagegenerationstopped
4182
+ '''
4183
+
4184
+ chat: Chat
4185
+ draft_id: int
4186
+ message_thread_id: Optional[int] = Field(default=None)
4187
+
4067
4188
  class PollOptionAdded(BaseModel):
4068
4189
  '''
4069
4190
  Describes a service message about an option added
@@ -4134,18 +4255,29 @@ class ChecklistTasksAdded(BaseModel):
4134
4255
 
4135
4256
  class CommunityChatAdded(BaseModel):
4136
4257
  '''
4137
- Describes a service message about a chat being
4138
- added to a community.
4258
+ Describes a service message about a chat or
4259
+ a bot being added to a community.
4139
4260
 
4140
4261
  Reference: https://core.telegram.org/bots/api#communitychatadded
4141
4262
  '''
4142
4263
 
4143
4264
  community: Community
4144
4265
 
4145
- class CommunityChatRemoved(BaseModel):
4266
+ class CommunityChatJoined(BaseModel):
4146
4267
  '''
4147
4268
  Describes a service message about a chat being
4148
- removed from a community. Currently holds no information.
4269
+ joined by a user from a community.
4270
+
4271
+ Reference: https://core.telegram.org/bots/api#communitychatjoined
4272
+ '''
4273
+
4274
+ community: Community
4275
+
4276
+ class CommunityChatRemoved(BaseModel):
4277
+ '''
4278
+ Describes a service message about a chat or
4279
+ a bot being removed from a community. Currently
4280
+ holds no information.
4149
4281
 
4150
4282
  Reference: https://core.telegram.org/bots/api#communitychatremoved
4151
4283
  '''
@@ -4629,7 +4761,8 @@ class ReplyKeyboardMarkup(BaseModel):
4629
4761
  resize_keyboard: Optional[bool] = Field(default=None)
4630
4762
  one_time_keyboard: Optional[bool] = Field(default=None)
4631
4763
  input_field_placeholder: Optional[str] = Field(default=None)
4632
- selective: Optional[bool] = Field(default=None)
4764
+ selective: Optional[bool] = Field(default=None)
4765
+ force_reply: Optional[bool] = Field(default=None)
4633
4766
 
4634
4767
  class KeyboardButton(BaseModel):
4635
4768
  '''
@@ -4749,6 +4882,7 @@ class InlineKeyboardMarkup(BaseModel):
4749
4882
  '''
4750
4883
 
4751
4884
  inline_keyboard: List[List[InlineKeyboardButton]]
4885
+ force_reply: Optional[bool] = Field(default=None)
4752
4886
 
4753
4887
  @staticmethod
4754
4888
  def from_dict(
@@ -4787,17 +4921,18 @@ class InlineKeyboardButton(BaseModel):
4787
4921
  switch_inline_query_chosen_chat: Optional[SwitchInlineQueryChosenChat] = Field(default=None)
4788
4922
  copy_text: Optional[CopyTextButton] = Field(default=None)
4789
4923
  callback_game: Optional[CallbackGame] = Field(default=None)
4790
- pay: Optional[bool] = Field(default=None)
4924
+ pay: Optional[bool] = Field(default=None)
4925
+ disabled: Optional[DisabledButton] = Field(default=None)
4791
4926
 
4792
4927
  class LoginUrl(BaseModel):
4793
4928
  '''
4794
4929
  This object represents a parameter of the inline
4795
4930
  keyboard button used to automatically authorize a user.
4796
- Serves as a great replacement for the Telegram
4797
- Login Widget when the user is coming from
4798
- Telegram. All the user needs to do is
4799
- tap/click a button and confirm that they want
4800
- to log in:
4931
+ It serves as a great replacement for the
4932
+ Telegram Login Widget when the user is coming
4933
+ from Telegram. All the user needs to do
4934
+ is tap/click a button and confirm that they
4935
+ want to log in:
4801
4936
 
4802
4937
  Reference: https://core.telegram.org/bots/api#loginurl
4803
4938
  '''
@@ -4832,6 +4967,17 @@ class CopyTextButton(BaseModel):
4832
4967
 
4833
4968
  text: str
4834
4969
 
4970
+ class DisabledButton(BaseModel):
4971
+ '''
4972
+ This object represents a disabled button which does
4973
+ nothing. Currently holds no information.
4974
+
4975
+ Reference: https://core.telegram.org/bots/api#disabledbutton
4976
+ '''
4977
+
4978
+ pass
4979
+
4980
+
4835
4981
  class CallbackQuery(BaseModel):
4836
4982
  '''
4837
4983
  This object represents an incoming callback query from
@@ -4933,6 +5079,7 @@ class ChatAdministratorRights(BaseModel):
4933
5079
  can_post_stories: bool
4934
5080
  can_edit_stories: bool
4935
5081
  can_delete_stories: bool
5082
+ can_send_welcome_messages: bool
4936
5083
  can_post_messages: Optional[bool] = Field(default=None)
4937
5084
  can_edit_messages: Optional[bool] = Field(default=None)
4938
5085
  can_pin_messages: Optional[bool] = Field(default=None)
@@ -5349,6 +5496,9 @@ class UniqueGiftInfo(BaseModel):
5349
5496
 
5350
5497
  gift: UniqueGift
5351
5498
  origin: str
5499
+ text: Optional[str] = Field(default=None)
5500
+ entities: Optional[List[MessageEntity]] = Field(default=None)
5501
+ is_private: Optional[bool] = Field(default=None)
5352
5502
  last_resale_currency: Optional[str] = Field(default=None)
5353
5503
  last_resale_amount: Optional[int] = Field(default=None)
5354
5504
  owned_gift_id: Optional[str] = Field(default=None)
@@ -5757,7 +5907,29 @@ class InputRichMessageMedia(BaseModel):
5757
5907
  '''
5758
5908
 
5759
5909
  id: str
5760
- media: Union[InputMediaAnimation, InputMediaAudio, InputMediaPhoto, InputMediaVideo, InputMediaVoiceNote]
5910
+ media: Union[InputMediaAnimation, InputMediaAudio, InputMediaDocument, InputMediaPhoto, InputMediaVideo, InputMediaVoiceNote]
5911
+
5912
+ class RichMessageButton(BaseModel):
5913
+ '''
5914
+ This object represents a button in a RichMessage.
5915
+ Exactly one of the fields other than text
5916
+ and style must be used to specify the
5917
+ type of the button.
5918
+
5919
+ Reference: https://core.telegram.org/bots/api#richmessagebutton
5920
+ '''
5921
+
5922
+ text: _RichText
5923
+ style: Optional[str] = Field(default=None)
5924
+ url: Optional[str] = Field(default=None)
5925
+ callback_data: Optional[str] = Field(default=None)
5926
+ web_app: Optional[WebAppInfo] = Field(default=None)
5927
+ login_url: Optional[LoginUrl] = Field(default=None)
5928
+ switch_inline_query: Optional[str] = Field(default=None)
5929
+ switch_inline_query_current_chat: Optional[str] = Field(default=None)
5930
+ switch_inline_query_chosen_chat: Optional[SwitchInlineQueryChosenChat] = Field(default=None)
5931
+ copy_text: Optional[CopyTextButton] = Field(default=None)
5932
+ disabled: Optional[DisabledButton] = Field(default=None)
5761
5933
 
5762
5934
  class RichBlockCaption(BaseModel):
5763
5935
  '''
File without changes