botapi-py 1.4.5__tar.gz → 1.4.7__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.4.5
3
+ Version: 1.4.7
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.4.5"
3
+ version = "1.4.7"
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 = [
@@ -140,6 +140,7 @@ from .types import (
140
140
  BusinessLocation,
141
141
  BusinessOpeningHoursInterval,
142
142
  BusinessOpeningHours,
143
+ UserRating,
143
144
  StoryAreaPosition,
144
145
  LocationAddress,
145
146
  StoryAreaType,
@@ -160,12 +161,14 @@ from .types import (
160
161
  MessageReactionUpdated,
161
162
  MessageReactionCountUpdated,
162
163
  ForumTopic,
164
+ GiftBackground,
163
165
  Gift,
164
166
  Gifts,
165
167
  UniqueGiftModel,
166
168
  UniqueGiftSymbol,
167
169
  UniqueGiftBackdropColors,
168
170
  UniqueGiftBackdrop,
171
+ UniqueGiftColors,
169
172
  UniqueGift,
170
173
  GiftInfo,
171
174
  UniqueGiftInfo,
@@ -316,7 +319,9 @@ from .types import (
316
319
  BoolAdapter,
317
320
  )
318
321
 
319
- class Bot(core.BaseBot):
322
+ from .shortcuts import BotShortcuts
323
+
324
+ class Bot(core.BaseBot, BotShortcuts):
320
325
  '''
321
326
  Creates an instance of a new Bot API client.
322
327
 
@@ -522,6 +527,7 @@ class Bot(core.BaseBot):
522
527
  video_start_timestamp: Optional[int] = None,
523
528
  disable_notification: Optional[bool] = None,
524
529
  protect_content: Optional[bool] = None,
530
+ message_effect_id: Optional[str] = None,
525
531
  suggested_post_parameters: Optional[SuggestedPostParameters] = None,
526
532
  ) -> Message:
527
533
  '''
@@ -541,6 +547,7 @@ class Bot(core.BaseBot):
541
547
  'video_start_timestamp': video_start_timestamp,
542
548
  'disable_notification': disable_notification,
543
549
  'protect_content': protect_content,
550
+ 'message_effect_id': message_effect_id,
544
551
  'suggested_post_parameters': suggested_post_parameters,
545
552
  'message_id': message_id,
546
553
  })
@@ -594,6 +601,7 @@ class Bot(core.BaseBot):
594
601
  disable_notification: Optional[bool] = None,
595
602
  protect_content: Optional[bool] = None,
596
603
  allow_paid_broadcast: Optional[bool] = None,
604
+ message_effect_id: Optional[str] = None,
597
605
  suggested_post_parameters: Optional[SuggestedPostParameters] = None,
598
606
  reply_parameters: Optional[ReplyParameters] = None,
599
607
  reply_markup: Optional[Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]] = None,
@@ -627,6 +635,7 @@ class Bot(core.BaseBot):
627
635
  'disable_notification': disable_notification,
628
636
  'protect_content': protect_content,
629
637
  'allow_paid_broadcast': allow_paid_broadcast,
638
+ 'message_effect_id': message_effect_id,
630
639
  'suggested_post_parameters': suggested_post_parameters,
631
640
  'reply_parameters': reply_parameters,
632
641
  'reply_markup': reply_markup,
@@ -1062,7 +1071,7 @@ class Bot(core.BaseBot):
1062
1071
  self,
1063
1072
  chat_id: Union[int, str],
1064
1073
  star_count: int,
1065
- media: List[_InputPaidMedia],
1074
+ media: List[InputPaidMedia],
1066
1075
  business_connection_id: Optional[str] = None,
1067
1076
  message_thread_id: Optional[int] = None,
1068
1077
  direct_messages_topic_id: Optional[int] = None,
@@ -1418,6 +1427,34 @@ class Bot(core.BaseBot):
1418
1427
  })
1419
1428
  return Message.model_validate(response)
1420
1429
 
1430
+ async def send_message_draft(
1431
+ self,
1432
+ chat_id: int,
1433
+ draft_id: int,
1434
+ text: str,
1435
+ message_thread_id: Optional[int] = None,
1436
+ parse_mode: Optional[enums.ParseMode] = enums.ParseMode.HTML,
1437
+ entities: Optional[List[MessageEntity]] = None,
1438
+ ) -> bool:
1439
+ '''
1440
+ Use this method to stream a partial message
1441
+ to a user while the message is being
1442
+ generated; supported only for bots with forum topic
1443
+ mode enabled. Returns True on success.
1444
+
1445
+ Reference: https://core.telegram.org/bots/api#sendmessagedraft
1446
+ '''
1447
+
1448
+ response = await self._send_request('sendMessageDraft', {
1449
+ 'chat_id': chat_id,
1450
+ 'message_thread_id': message_thread_id,
1451
+ 'draft_id': draft_id,
1452
+ 'text': text,
1453
+ 'parse_mode': parse_mode if not entities else None, # FIX,
1454
+ 'entities': entities,
1455
+ })
1456
+ return BoolAdapter.validate_python(response)
1457
+
1421
1458
  async def send_chat_action(
1422
1459
  self,
1423
1460
  chat_id: Union[int, str],
@@ -1448,7 +1485,7 @@ class Bot(core.BaseBot):
1448
1485
  self,
1449
1486
  chat_id: Union[int, str],
1450
1487
  message_id: int,
1451
- reaction: Optional[List[_ReactionType]] = None,
1488
+ reaction: Optional[List[ReactionType]] = None,
1452
1489
  is_big: Optional[bool] = None,
1453
1490
  ) -> bool:
1454
1491
  '''
@@ -2158,7 +2195,7 @@ class Bot(core.BaseBot):
2158
2195
  async def get_chat_administrators(
2159
2196
  self,
2160
2197
  chat_id: Union[int, str],
2161
- ) -> List[_ChatMember]:
2198
+ ) -> List[ChatMember]:
2162
2199
  '''
2163
2200
  Use this method to get a list of
2164
2201
  administrators in a chat, which aren't bots. Returns
@@ -2192,7 +2229,7 @@ class Bot(core.BaseBot):
2192
2229
  self,
2193
2230
  chat_id: Union[int, str],
2194
2231
  user_id: int,
2195
- ) -> _ChatMember:
2232
+ ) -> ChatMember:
2196
2233
  '''
2197
2234
  Use this method to get information about a
2198
2235
  member of a chat. The method is only
@@ -2303,11 +2340,13 @@ class Bot(core.BaseBot):
2303
2340
  ) -> bool:
2304
2341
  '''
2305
2342
  Use this method to edit name and icon
2306
- of a topic in a forum supergroup chat.
2307
- The bot must be an administrator in the
2308
- chat for this to work and must have
2309
- the can_manage_topics administrator rights, unless it is the
2310
- creator of the topic. Returns True on success.
2343
+ of a topic in a forum supergroup chat
2344
+ or a private chat with a user. In
2345
+ the case of a supergroup chat the bot
2346
+ must be an administrator in the chat for
2347
+ this to work and must have the can_manage_topics
2348
+ administrator rights, unless it is the creator of
2349
+ the topic. Returns True on success.
2311
2350
 
2312
2351
  Reference: https://core.telegram.org/bots/api#editforumtopic
2313
2352
  '''
@@ -2372,10 +2411,11 @@ class Bot(core.BaseBot):
2372
2411
  '''
2373
2412
  Use this method to delete a forum topic
2374
2413
  along with all its messages in a forum
2375
- supergroup chat. The bot must be an administrator
2376
- in the chat for this to work and
2377
- must have the can_delete_messages administrator rights. Returns True
2378
- on success.
2414
+ supergroup chat or a private chat with a
2415
+ user. In the case of a supergroup chat
2416
+ the bot must be an administrator in the
2417
+ chat for this to work and must have
2418
+ the can_delete_messages administrator rights. Returns True on success.
2379
2419
 
2380
2420
  Reference: https://core.telegram.org/bots/api#deleteforumtopic
2381
2421
  '''
@@ -2393,11 +2433,13 @@ class Bot(core.BaseBot):
2393
2433
  ) -> bool:
2394
2434
  '''
2395
2435
  Use this method to clear the list of
2396
- pinned messages in a forum topic. The bot
2397
- must be an administrator in the chat for
2398
- this to work and must have the can_pin_messages
2399
- administrator right in the supergroup. Returns True on
2400
- success.
2436
+ pinned messages in a forum topic in a
2437
+ forum supergroup chat or a private chat with
2438
+ a user. In the case of a supergroup
2439
+ chat the bot must be an administrator in
2440
+ the chat for this to work and must
2441
+ have the can_pin_messages administrator right in the supergroup.
2442
+ Returns True on success.
2401
2443
 
2402
2444
  Reference: https://core.telegram.org/bots/api#unpinallforumtopicmessages
2403
2445
  '''
@@ -2594,7 +2636,7 @@ class Bot(core.BaseBot):
2594
2636
  async def set_my_commands(
2595
2637
  self,
2596
2638
  commands: List[BotCommand],
2597
- scope: Optional[_BotCommandScope] = None,
2639
+ scope: Optional[BotCommandScope] = None,
2598
2640
  language_code: Optional[str] = None,
2599
2641
  ) -> bool:
2600
2642
  '''
@@ -2614,7 +2656,7 @@ class Bot(core.BaseBot):
2614
2656
 
2615
2657
  async def delete_my_commands(
2616
2658
  self,
2617
- scope: Optional[_BotCommandScope] = None,
2659
+ scope: Optional[BotCommandScope] = None,
2618
2660
  language_code: Optional[str] = None,
2619
2661
  ) -> bool:
2620
2662
  '''
@@ -2635,7 +2677,7 @@ class Bot(core.BaseBot):
2635
2677
 
2636
2678
  async def get_my_commands(
2637
2679
  self,
2638
- scope: Optional[_BotCommandScope] = None,
2680
+ scope: Optional[BotCommandScope] = None,
2639
2681
  language_code: Optional[str] = None,
2640
2682
  ) -> List[BotCommand]:
2641
2683
  '''
@@ -2767,7 +2809,7 @@ class Bot(core.BaseBot):
2767
2809
  async def set_chat_menu_button(
2768
2810
  self,
2769
2811
  chat_id: Optional[int] = None,
2770
- menu_button: Optional[_MenuButton] = None,
2812
+ menu_button: Optional[MenuButton] = None,
2771
2813
  ) -> bool:
2772
2814
  '''
2773
2815
  Use this method to change the bot's menu
@@ -2786,7 +2828,7 @@ class Bot(core.BaseBot):
2786
2828
  async def get_chat_menu_button(
2787
2829
  self,
2788
2830
  chat_id: Optional[int] = None,
2789
- ) -> _MenuButton:
2831
+ ) -> MenuButton:
2790
2832
  '''
2791
2833
  Use this method to get the current value
2792
2834
  of the bot's menu button in a private
@@ -3086,7 +3128,7 @@ class Bot(core.BaseBot):
3086
3128
  async def set_business_account_profile_photo(
3087
3129
  self,
3088
3130
  business_connection_id: str,
3089
- photo: _InputProfilePhoto,
3131
+ photo: InputProfilePhoto,
3090
3132
  is_public: Optional[bool] = None,
3091
3133
  ) -> bool:
3092
3134
  '''
@@ -3186,8 +3228,10 @@ class Bot(core.BaseBot):
3186
3228
  exclude_unsaved: Optional[bool] = None,
3187
3229
  exclude_saved: Optional[bool] = None,
3188
3230
  exclude_unlimited: Optional[bool] = None,
3189
- exclude_limited: Optional[bool] = None,
3231
+ exclude_limited_upgradable: Optional[bool] = None,
3232
+ exclude_limited_non_upgradable: Optional[bool] = None,
3190
3233
  exclude_unique: Optional[bool] = None,
3234
+ exclude_from_blockchain: Optional[bool] = None,
3191
3235
  sort_by_price: Optional[bool] = None,
3192
3236
  offset: Optional[str] = None,
3193
3237
  limit: Optional[int] = None,
@@ -3205,7 +3249,77 @@ class Bot(core.BaseBot):
3205
3249
  'exclude_unsaved': exclude_unsaved,
3206
3250
  'exclude_saved': exclude_saved,
3207
3251
  'exclude_unlimited': exclude_unlimited,
3208
- 'exclude_limited': exclude_limited,
3252
+ 'exclude_limited_upgradable': exclude_limited_upgradable,
3253
+ 'exclude_limited_non_upgradable': exclude_limited_non_upgradable,
3254
+ 'exclude_unique': exclude_unique,
3255
+ 'exclude_from_blockchain': exclude_from_blockchain,
3256
+ 'sort_by_price': sort_by_price,
3257
+ 'offset': offset,
3258
+ 'limit': limit,
3259
+ })
3260
+ return OwnedGifts.model_validate(response)
3261
+
3262
+ async def get_user_gifts(
3263
+ self,
3264
+ user_id: int,
3265
+ exclude_unlimited: Optional[bool] = None,
3266
+ exclude_limited_upgradable: Optional[bool] = None,
3267
+ exclude_limited_non_upgradable: Optional[bool] = None,
3268
+ exclude_from_blockchain: Optional[bool] = None,
3269
+ exclude_unique: Optional[bool] = None,
3270
+ sort_by_price: Optional[bool] = None,
3271
+ offset: Optional[str] = None,
3272
+ limit: Optional[int] = None,
3273
+ ) -> OwnedGifts:
3274
+ '''
3275
+ Returns the gifts owned and hosted by a
3276
+ user. Returns OwnedGifts on success.
3277
+
3278
+ Reference: https://core.telegram.org/bots/api#getusergifts
3279
+ '''
3280
+
3281
+ response = await self._send_request('getUserGifts', {
3282
+ 'user_id': user_id,
3283
+ 'exclude_unlimited': exclude_unlimited,
3284
+ 'exclude_limited_upgradable': exclude_limited_upgradable,
3285
+ 'exclude_limited_non_upgradable': exclude_limited_non_upgradable,
3286
+ 'exclude_from_blockchain': exclude_from_blockchain,
3287
+ 'exclude_unique': exclude_unique,
3288
+ 'sort_by_price': sort_by_price,
3289
+ 'offset': offset,
3290
+ 'limit': limit,
3291
+ })
3292
+ return OwnedGifts.model_validate(response)
3293
+
3294
+ async def get_chat_gifts(
3295
+ self,
3296
+ chat_id: Union[int, str],
3297
+ exclude_unsaved: Optional[bool] = None,
3298
+ exclude_saved: Optional[bool] = None,
3299
+ exclude_unlimited: Optional[bool] = None,
3300
+ exclude_limited_upgradable: Optional[bool] = None,
3301
+ exclude_limited_non_upgradable: Optional[bool] = None,
3302
+ exclude_from_blockchain: Optional[bool] = None,
3303
+ exclude_unique: Optional[bool] = None,
3304
+ sort_by_price: Optional[bool] = None,
3305
+ offset: Optional[str] = None,
3306
+ limit: Optional[int] = None,
3307
+ ) -> OwnedGifts:
3308
+ '''
3309
+ Returns the gifts owned by a chat. Returns
3310
+ OwnedGifts on success.
3311
+
3312
+ Reference: https://core.telegram.org/bots/api#getchatgifts
3313
+ '''
3314
+
3315
+ response = await self._send_request('getChatGifts', {
3316
+ 'chat_id': chat_id,
3317
+ 'exclude_unsaved': exclude_unsaved,
3318
+ 'exclude_saved': exclude_saved,
3319
+ 'exclude_unlimited': exclude_unlimited,
3320
+ 'exclude_limited_upgradable': exclude_limited_upgradable,
3321
+ 'exclude_limited_non_upgradable': exclude_limited_non_upgradable,
3322
+ 'exclude_from_blockchain': exclude_from_blockchain,
3209
3323
  'exclude_unique': exclude_unique,
3210
3324
  'sort_by_price': sort_by_price,
3211
3325
  'offset': offset,
@@ -3283,7 +3397,7 @@ class Bot(core.BaseBot):
3283
3397
  async def post_story(
3284
3398
  self,
3285
3399
  business_connection_id: str,
3286
- content: _InputStoryContent,
3400
+ content: InputStoryContent,
3287
3401
  active_period: int,
3288
3402
  caption: Optional[str] = None,
3289
3403
  parse_mode: Optional[enums.ParseMode] = enums.ParseMode.HTML,
@@ -3313,11 +3427,42 @@ class Bot(core.BaseBot):
3313
3427
  })
3314
3428
  return Story.model_validate(response)
3315
3429
 
3430
+ async def repost_story(
3431
+ self,
3432
+ business_connection_id: str,
3433
+ from_chat_id: int,
3434
+ from_story_id: int,
3435
+ active_period: int,
3436
+ post_to_chat_page: Optional[bool] = None,
3437
+ protect_content: Optional[bool] = None,
3438
+ ) -> Story:
3439
+ '''
3440
+ Reposts a story on behalf of a business
3441
+ account from another business account. Both business accounts
3442
+ must be managed by the same bot, and
3443
+ the story on the source account must have
3444
+ been posted (or reposted) by the bot. Requires
3445
+ the can_manage_stories business bot right for both business
3446
+ accounts. Returns Story on success.
3447
+
3448
+ Reference: https://core.telegram.org/bots/api#repoststory
3449
+ '''
3450
+
3451
+ response = await self._send_request('repostStory', {
3452
+ 'business_connection_id': business_connection_id,
3453
+ 'from_chat_id': from_chat_id,
3454
+ 'from_story_id': from_story_id,
3455
+ 'active_period': active_period,
3456
+ 'post_to_chat_page': post_to_chat_page,
3457
+ 'protect_content': protect_content,
3458
+ })
3459
+ return Story.model_validate(response)
3460
+
3316
3461
  async def edit_story(
3317
3462
  self,
3318
3463
  business_connection_id: str,
3319
3464
  story_id: int,
3320
- content: _InputStoryContent,
3465
+ content: InputStoryContent,
3321
3466
  caption: Optional[str] = None,
3322
3467
  parse_mode: Optional[enums.ParseMode] = enums.ParseMode.HTML,
3323
3468
  caption_entities: Optional[List[MessageEntity]] = None,
@@ -3447,7 +3592,7 @@ class Bot(core.BaseBot):
3447
3592
 
3448
3593
  async def edit_message_media(
3449
3594
  self,
3450
- media: _InputMedia,
3595
+ media: InputMedia,
3451
3596
  business_connection_id: Optional[str] = None,
3452
3597
  chat_id: Optional[Union[int, str]] = None,
3453
3598
  message_id: Optional[int] = None,
@@ -4091,7 +4236,7 @@ class Bot(core.BaseBot):
4091
4236
  async def answer_inline_query(
4092
4237
  self,
4093
4238
  inline_query_id: str,
4094
- results: List[_InlineQueryResult],
4239
+ results: List[InlineQueryResult],
4095
4240
  cache_time: Optional[int] = None,
4096
4241
  is_personal: Optional[bool] = None,
4097
4242
  next_offset: Optional[str] = None,
@@ -4118,7 +4263,7 @@ class Bot(core.BaseBot):
4118
4263
  async def answer_web_app_query(
4119
4264
  self,
4120
4265
  web_app_query_id: str,
4121
- result: _InlineQueryResult,
4266
+ result: InlineQueryResult,
4122
4267
  ) -> SentWebAppMessage:
4123
4268
  '''
4124
4269
  Use this method to set the result of
@@ -4139,7 +4284,7 @@ class Bot(core.BaseBot):
4139
4284
  async def save_prepared_inline_message(
4140
4285
  self,
4141
4286
  user_id: int,
4142
- result: _InlineQueryResult,
4287
+ result: InlineQueryResult,
4143
4288
  allow_user_chats: Optional[bool] = None,
4144
4289
  allow_bot_chats: Optional[bool] = None,
4145
4290
  allow_group_chats: Optional[bool] = None,
@@ -4424,7 +4569,7 @@ class Bot(core.BaseBot):
4424
4569
  async def set_passport_data_errors(
4425
4570
  self,
4426
4571
  user_id: int,
4427
- errors: List[_PassportElementError],
4572
+ errors: List[PassportElementError],
4428
4573
  ) -> bool:
4429
4574
  '''
4430
4575
  Informs a user that some of the Telegram
@@ -0,0 +1,141 @@
1
+ from __future__ import annotations
2
+
3
+ from typing import Optional, Union, List, cast
4
+
5
+ from . import enums
6
+ from . import types
7
+
8
+ from . import methods
9
+
10
+
11
+ class BotShortcuts:
12
+ '''
13
+ Mixin class containing shortcut bound methods for the `Bot` class.
14
+ These methods provide convenient wrappers around standard API methods.
15
+ '''
16
+
17
+ async def send_media(
18
+ self,
19
+ chat_id: Union[int, str],
20
+ media: Union[types.InputFile, str],
21
+ file_type: enums.MediaType,
22
+ caption: Optional[str] = None,
23
+ parse_mode: Optional[Union[str, enums.ParseMode]] = enums.ParseMode.HTML,
24
+ caption_entities: Optional[List[types.MessageEntity]] = None,
25
+ show_caption_above_media: Optional[bool] = None,
26
+ has_spoiler: Optional[bool] = None,
27
+ disable_notification: Optional[bool] = None,
28
+ protect_content: Optional[bool] = None,
29
+ reply_parameters: Optional[types.ReplyParameters] = None,
30
+ reply_markup: Optional[Union[types.InlineKeyboardMarkup, types.ReplyKeyboardMarkup, types.ReplyKeyboardRemove, types.ForceReply]] = None,
31
+ message_effect_id: Optional[str] = None,
32
+ allow_paid_broadcast: Optional[bool] = None,
33
+ business_connection_id: Optional[str] = None,
34
+ message_thread_id: Optional[int] = None,
35
+ ) -> types.Message:
36
+ '''
37
+ Method that sends common types of media by automatically routing to the correct `send_<type>` method.
38
+
39
+ :param chat_id: Unique identifier for the target chat or username of the target channel.
40
+ :param media: File to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data.
41
+ :param file_type: The type of media to send. Use `enums.MediaType`.
42
+ :param caption: Media caption, 0-1024 characters.
43
+ :param parse_mode: Mode for parsing entities in the media caption.
44
+ :param caption_entities: A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode.
45
+ :param show_caption_above_media: Pass True, if the caption must be shown above the message media.
46
+ :param has_spoiler: Pass True if the media needs to be covered with a spoiler animation.
47
+ :param disable_notification: Sends the message silently. Users will receive a notification with no sound.
48
+ :param protect_content: Protects the contents of the sent message from forwarding and saving.
49
+ :param reply_parameters: Description of the message to reply to.
50
+ :param reply_markup: Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user.
51
+ :param message_effect_id: Unique identifier of the message effect to be added to the message.
52
+ :param allow_paid_broadcast: Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance.
53
+ :param business_connection_id: Unique identifier of the business connection on behalf of which the message will be sent.
54
+ :param message_thread_id: Unique identifier for the target message thread (topic) of the forum; for forum supergroups only.
55
+ :param kwargs: Additional arguments specific to the target method (e.g. `duration`, `width`, `height`, `thumbnail`, `performer`, `title`).
56
+ :return: On success, the sent Message is returned.
57
+ '''
58
+ bot = cast(methods.Bot, self)
59
+
60
+ call_args: dict = {
61
+ 'chat_id': chat_id,
62
+ 'caption': caption,
63
+ 'parse_mode': parse_mode,
64
+ 'caption_entities': caption_entities,
65
+ 'disable_notification': disable_notification,
66
+ 'protect_content': protect_content,
67
+ 'reply_parameters': reply_parameters,
68
+ 'reply_markup': reply_markup,
69
+ 'message_effect_id': message_effect_id,
70
+ 'allow_paid_broadcast': allow_paid_broadcast,
71
+ 'business_connection_id': business_connection_id,
72
+ 'message_thread_id': message_thread_id,
73
+ 'has_spoiler': has_spoiler,
74
+ 'show_caption_above_media': show_caption_above_media,
75
+ }
76
+
77
+ match file_type:
78
+
79
+ case enums.MediaType.PHOTO:
80
+ call_args['photo'] = media
81
+ return await bot.send_photo(**call_args)
82
+
83
+ case enums.MediaType.VIDEO:
84
+ call_args['video'] = media
85
+ return await bot.send_video(**call_args)
86
+
87
+ case enums.MediaType.ANIMATION:
88
+ call_args['animation'] = media
89
+ return await bot.send_animation(**call_args)
90
+
91
+ case enums.MediaType.AUDIO:
92
+ call_args['audio'] = media
93
+ # Audio doesn't support has_spoiler or show_caption_above_media in some versions,
94
+ # but check API. core.telegram.org/bots/api#sendaudio says no spoiler, no caption above.
95
+ # We should probably filter them out to avoid errors if the underlying method relies on strict matching?
96
+ # generated methods typically accept **kwargs only if defined? No, generated methods have explicit args.
97
+ # If I pass 'has_spoiler' to send_audio and it's not in signature, it might fail if I use **call_args matching a signature.
98
+ # Python's **kwargs unpacking into a function call fails if keys don't match arguments (unless function has **kwargs).
99
+ # The generated methods DO NOT have **kwargs. They have explicit arguments.
100
+ # So I MUST NOT pass extra arguments.
101
+
102
+ call_args.pop('has_spoiler', None)
103
+ call_args.pop('show_caption_above_media', None)
104
+ return await bot.send_audio(**call_args)
105
+
106
+ case enums.MediaType.DOCUMENT:
107
+ call_args['document'] = media
108
+ # Document supports disable_content_type_detection
109
+ call_args.pop('has_spoiler', None)
110
+ call_args.pop('show_caption_above_media', None)
111
+ return await bot.send_document(**call_args)
112
+
113
+ case enums.MediaType.VOICE:
114
+ call_args['voice'] = media
115
+ call_args.pop('has_spoiler', None)
116
+ call_args.pop('show_caption_above_media', None)
117
+ return await bot.send_voice(**call_args)
118
+
119
+ case enums.MediaType.VIDEO_NOTE:
120
+ call_args['video_note'] = media
121
+ call_args.pop('has_spoiler', None)
122
+ call_args.pop('show_caption_above_media', None)
123
+ call_args.pop('caption', None) # Video notes don't have captions
124
+ call_args.pop('parse_mode', None)
125
+ call_args.pop('caption_entities', None)
126
+ return await bot.send_video_note(**call_args)
127
+
128
+ case enums.MediaType.STICKER:
129
+ call_args['sticker'] = media
130
+ # Sticker is quite different
131
+ call_args.pop('caption', None)
132
+ call_args.pop('parse_mode', None)
133
+ call_args.pop('caption_entities', None)
134
+ call_args.pop('has_spoiler', None)
135
+ call_args.pop('show_caption_above_media', None)
136
+ return await bot.send_sticker(**call_args)
137
+
138
+ case _:
139
+ # Fallback or Error
140
+ raise ValueError(f"Unsupported or unknown media type: {file_type}")
141
+
@@ -34,7 +34,7 @@ class Message(MaybeInaccessibleMessage, frozen=True):
34
34
  sender_boost_count: Optional[int] = Field(default=None)
35
35
  sender_business_bot: Optional[User] = Field(default=None)
36
36
  business_connection_id: Optional[str] = Field(default=None)
37
- forward_origin: Optional[_MessageOrigin] = Field(default=None)
37
+ forward_origin: Optional[MessageOrigin] = Field(default=None)
38
38
  is_topic_message: Optional[bool] = Field(default=None)
39
39
  is_automatic_forward: Optional[bool] = Field(default=None)
40
40
  reply_to_message: Optional[Message] = Field(default=None)
@@ -87,7 +87,7 @@ class Message(MaybeInaccessibleMessage, frozen=True):
87
87
  message_auto_delete_timer_changed: Optional[MessageAutoDeleteTimerChanged] = Field(default=None)
88
88
  migrate_to_chat_id: Optional[int] = Field(default=None)
89
89
  migrate_from_chat_id: Optional[int] = Field(default=None)
90
- pinned_message: Optional[_MaybeInaccessibleMessage] = Field(default=None)
90
+ pinned_message: Optional[MaybeInaccessibleMessage] = Field(default=None)
91
91
  invoice: Optional[Invoice] = Field(default=None)
92
92
  successful_payment: Optional[SuccessfulPayment] = Field(default=None)
93
93
  refunded_payment: Optional[RefundedPayment] = Field(default=None)
@@ -95,6 +95,7 @@ class Message(MaybeInaccessibleMessage, frozen=True):
95
95
  chat_shared: Optional[ChatShared] = Field(default=None)
96
96
  gift: Optional[GiftInfo] = Field(default=None)
97
97
  unique_gift: Optional[UniqueGiftInfo] = Field(default=None)
98
+ gift_upgrade_sent: Optional[GiftInfo] = Field(default=None)
98
99
  connected_website: Optional[str] = Field(default=None)
99
100
  write_access_allowed: Optional[WriteAccessAllowed] = Field(default=None)
100
101
  passport_data: Optional[PassportData] = Field(default=None)
@@ -177,6 +178,7 @@ class Message(MaybeInaccessibleMessage, frozen=True):
177
178
  message_thread_id: Optional[int] = None,
178
179
  direct_messages_topic_id: Optional[int] = None,
179
180
  video_start_timestamp: Optional[int] = None,
181
+ message_effect_id: Optional[str] = None,
180
182
  # suggested_post_parameters: Optional[SuggestedPostParameters] = None,
181
183
  ) -> Message:
182
184
  '''
@@ -192,6 +194,7 @@ class Message(MaybeInaccessibleMessage, frozen=True):
192
194
  video_start_timestamp=video_start_timestamp,
193
195
  disable_notification=disable_notification,
194
196
  protect_content=protect_content,
197
+ message_effect_id=message_effect_id,
195
198
  # suggested_post_parameters=suggested_post_parameters
196
199
  )
197
200
 
@@ -209,6 +212,7 @@ class Message(MaybeInaccessibleMessage, frozen=True):
209
212
  disable_notification: Optional[bool] = None,
210
213
  protect_content: Optional[bool] = None,
211
214
  # allow_paid_broadcast: Optional[bool] = None,
215
+ message_effect_id: Optional[str] = None,
212
216
  # suggested_post_parameters: Optional[SuggestedPostParameters] = None,
213
217
  # reply_parameters: Optional[ReplyParameters] = None,
214
218
  # reply_markup: Optional[Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]] = None
@@ -231,6 +235,7 @@ class Message(MaybeInaccessibleMessage, frozen=True):
231
235
  disable_notification=disable_notification,
232
236
  protect_content=protect_content,
233
237
  # allow_paid_broadcast=allow_paid_broadcast,
238
+ message_effect_id=message_effect_id,
234
239
  # suggested_post_parameters=suggested_post_parameters,
235
240
  # reply_parameters=reply_parameters,
236
241
  # reply_markup=reply_markup
@@ -337,19 +342,7 @@ class Message(MaybeInaccessibleMessage, frozen=True):
337
342
  )
338
343
 
339
344
  @property
340
- def media(self) -> Union[
341
- Animation,
342
- Audio,
343
- Document,
344
- list[PhotoSize],
345
- Sticker,
346
- Video,
347
- VideoNote,
348
- Voice,
349
- Story,
350
- PaidMedia,
351
- None
352
- ]:
345
+ def media(self) -> Optional[MediaTypeUnion]:
353
346
  '''
354
347
  Actual multimedia content of this message.
355
348
 
@@ -554,7 +547,7 @@ class BackgroundTypeFill(BackgroundType, frozen=True):
554
547
  '''
555
548
 
556
549
  type: Literal['fill'] = 'fill'
557
- fill: _BackgroundFill
550
+ fill: BackgroundFill
558
551
  dark_theme_dimming: int
559
552
 
560
553
  class BackgroundTypeWallpaper(BackgroundType, frozen=True):
@@ -583,7 +576,7 @@ class BackgroundTypePattern(BackgroundType, frozen=True):
583
576
 
584
577
  type: Literal['pattern'] = 'pattern'
585
578
  document: Document
586
- fill: _BackgroundFill
579
+ fill: BackgroundFill
587
580
  intensity: int
588
581
  is_inverted: Optional[bool] = Field(default=None)
589
582
  is_moving: Optional[bool] = Field(default=None)
@@ -754,7 +747,7 @@ class StoryAreaTypeSuggestedReaction(StoryAreaType, frozen=True):
754
747
  '''
755
748
 
756
749
  type: Literal['suggested_reaction'] = 'suggested_reaction'
757
- reaction_type: _ReactionType
750
+ reaction_type: ReactionType
758
751
  is_dark: Optional[bool] = Field(default=None)
759
752
  is_flipped: Optional[bool] = Field(default=None)
760
753
 
@@ -871,7 +864,9 @@ class OwnedGiftRegular(OwnedGift, frozen=True):
871
864
  can_be_upgraded: Optional[bool] = Field(default=None)
872
865
  was_refunded: Optional[bool] = Field(default=None)
873
866
  convert_star_count: Optional[int] = Field(default=None)
874
- prepaid_upgrade_star_count: Optional[int] = Field(default=None)
867
+ prepaid_upgrade_star_count: Optional[int] = Field(default=None)
868
+ is_upgrade_separate: Optional[bool] = Field(default=None)
869
+ unique_gift_number: Optional[int] = Field(default=None)
875
870
 
876
871
  class OwnedGiftUnique(OwnedGift, frozen=True):
877
872
  '''
@@ -1311,7 +1306,7 @@ class InlineQueryResultCachedAudio(InlineQueryResult, frozen=True):
1311
1306
  parse_mode: Optional[str] = Field(default=enums.ParseMode.HTML.value)
1312
1307
  caption_entities: Optional[List[MessageEntity]] = Field(default=None)
1313
1308
  reply_markup: Optional[InlineKeyboardMarkup] = Field(default=None)
1314
- input_message_content: Optional[_InputMessageContent] = Field(default=None)
1309
+ input_message_content: Optional[InputMessageContent] = Field(default=None)
1315
1310
 
1316
1311
  class InlineQueryResultCachedDocument(InlineQueryResult, frozen=True):
1317
1312
  '''
@@ -1334,7 +1329,7 @@ class InlineQueryResultCachedDocument(InlineQueryResult, frozen=True):
1334
1329
  parse_mode: Optional[str] = Field(default=enums.ParseMode.HTML.value)
1335
1330
  caption_entities: Optional[List[MessageEntity]] = Field(default=None)
1336
1331
  reply_markup: Optional[InlineKeyboardMarkup] = Field(default=None)
1337
- input_message_content: Optional[_InputMessageContent] = Field(default=None)
1332
+ input_message_content: Optional[InputMessageContent] = Field(default=None)
1338
1333
 
1339
1334
  class InlineQueryResultCachedGif(InlineQueryResult, frozen=True):
1340
1335
  '''
@@ -1357,7 +1352,7 @@ class InlineQueryResultCachedGif(InlineQueryResult, frozen=True):
1357
1352
  caption_entities: Optional[List[MessageEntity]] = Field(default=None)
1358
1353
  show_caption_above_media: Optional[bool] = Field(default=None)
1359
1354
  reply_markup: Optional[InlineKeyboardMarkup] = Field(default=None)
1360
- input_message_content: Optional[_InputMessageContent] = Field(default=None)
1355
+ input_message_content: Optional[InputMessageContent] = Field(default=None)
1361
1356
 
1362
1357
  class InlineQueryResultCachedMpeg4Gif(InlineQueryResult, frozen=True):
1363
1358
  '''
@@ -1381,7 +1376,7 @@ class InlineQueryResultCachedMpeg4Gif(InlineQueryResult, frozen=True):
1381
1376
  caption_entities: Optional[List[MessageEntity]] = Field(default=None)
1382
1377
  show_caption_above_media: Optional[bool] = Field(default=None)
1383
1378
  reply_markup: Optional[InlineKeyboardMarkup] = Field(default=None)
1384
- input_message_content: Optional[_InputMessageContent] = Field(default=None)
1379
+ input_message_content: Optional[InputMessageContent] = Field(default=None)
1385
1380
 
1386
1381
  class InlineQueryResultCachedPhoto(InlineQueryResult, frozen=True):
1387
1382
  '''
@@ -1405,7 +1400,7 @@ class InlineQueryResultCachedPhoto(InlineQueryResult, frozen=True):
1405
1400
  caption_entities: Optional[List[MessageEntity]] = Field(default=None)
1406
1401
  show_caption_above_media: Optional[bool] = Field(default=None)
1407
1402
  reply_markup: Optional[InlineKeyboardMarkup] = Field(default=None)
1408
- input_message_content: Optional[_InputMessageContent] = Field(default=None)
1403
+ input_message_content: Optional[InputMessageContent] = Field(default=None)
1409
1404
 
1410
1405
  class InlineQueryResultCachedSticker(InlineQueryResult, frozen=True):
1411
1406
  '''
@@ -1422,7 +1417,7 @@ class InlineQueryResultCachedSticker(InlineQueryResult, frozen=True):
1422
1417
  id: str
1423
1418
  sticker_file_id: str
1424
1419
  reply_markup: Optional[InlineKeyboardMarkup] = Field(default=None)
1425
- input_message_content: Optional[_InputMessageContent] = Field(default=None)
1420
+ input_message_content: Optional[InputMessageContent] = Field(default=None)
1426
1421
 
1427
1422
  class InlineQueryResultCachedVideo(InlineQueryResult, frozen=True):
1428
1423
  '''
@@ -1446,7 +1441,7 @@ class InlineQueryResultCachedVideo(InlineQueryResult, frozen=True):
1446
1441
  caption_entities: Optional[List[MessageEntity]] = Field(default=None)
1447
1442
  show_caption_above_media: Optional[bool] = Field(default=None)
1448
1443
  reply_markup: Optional[InlineKeyboardMarkup] = Field(default=None)
1449
- input_message_content: Optional[_InputMessageContent] = Field(default=None)
1444
+ input_message_content: Optional[InputMessageContent] = Field(default=None)
1450
1445
 
1451
1446
  class InlineQueryResultCachedVoice(InlineQueryResult, frozen=True):
1452
1447
  '''
@@ -1468,7 +1463,7 @@ class InlineQueryResultCachedVoice(InlineQueryResult, frozen=True):
1468
1463
  parse_mode: Optional[str] = Field(default=enums.ParseMode.HTML.value)
1469
1464
  caption_entities: Optional[List[MessageEntity]] = Field(default=None)
1470
1465
  reply_markup: Optional[InlineKeyboardMarkup] = Field(default=None)
1471
- input_message_content: Optional[_InputMessageContent] = Field(default=None)
1466
+ input_message_content: Optional[InputMessageContent] = Field(default=None)
1472
1467
 
1473
1468
  class InlineQueryResultArticle(InlineQueryResult, frozen=True):
1474
1469
  '''
@@ -1481,7 +1476,7 @@ class InlineQueryResultArticle(InlineQueryResult, frozen=True):
1481
1476
  type: Literal['article'] = 'article'
1482
1477
  id: str
1483
1478
  title: str
1484
- input_message_content: _InputMessageContent
1479
+ input_message_content: InputMessageContent
1485
1480
  reply_markup: Optional[InlineKeyboardMarkup] = Field(default=None)
1486
1481
  url: Optional[str] = Field(default=None)
1487
1482
  description: Optional[str] = Field(default=None)
@@ -1510,7 +1505,7 @@ class InlineQueryResultAudio(InlineQueryResult, frozen=True):
1510
1505
  performer: Optional[str] = Field(default=None)
1511
1506
  audio_duration: Optional[int] = Field(default=None)
1512
1507
  reply_markup: Optional[InlineKeyboardMarkup] = Field(default=None)
1513
- input_message_content: Optional[_InputMessageContent] = Field(default=None)
1508
+ input_message_content: Optional[InputMessageContent] = Field(default=None)
1514
1509
 
1515
1510
  class InlineQueryResultContact(InlineQueryResult, frozen=True):
1516
1511
  '''
@@ -1530,7 +1525,7 @@ class InlineQueryResultContact(InlineQueryResult, frozen=True):
1530
1525
  last_name: Optional[str] = Field(default=None)
1531
1526
  vcard: Optional[str] = Field(default=None)
1532
1527
  reply_markup: Optional[InlineKeyboardMarkup] = Field(default=None)
1533
- input_message_content: Optional[_InputMessageContent] = Field(default=None)
1528
+ input_message_content: Optional[InputMessageContent] = Field(default=None)
1534
1529
  thumbnail_url: Optional[str] = Field(default=None)
1535
1530
  thumbnail_width: Optional[int] = Field(default=None)
1536
1531
  thumbnail_height: Optional[int] = Field(default=None)
@@ -1570,7 +1565,7 @@ class InlineQueryResultDocument(InlineQueryResult, frozen=True):
1570
1565
  caption_entities: Optional[List[MessageEntity]] = Field(default=None)
1571
1566
  description: Optional[str] = Field(default=None)
1572
1567
  reply_markup: Optional[InlineKeyboardMarkup] = Field(default=None)
1573
- input_message_content: Optional[_InputMessageContent] = Field(default=None)
1568
+ input_message_content: Optional[InputMessageContent] = Field(default=None)
1574
1569
  thumbnail_url: Optional[str] = Field(default=None)
1575
1570
  thumbnail_width: Optional[int] = Field(default=None)
1576
1571
  thumbnail_height: Optional[int] = Field(default=None)
@@ -1600,7 +1595,7 @@ class InlineQueryResultGif(InlineQueryResult, frozen=True):
1600
1595
  caption_entities: Optional[List[MessageEntity]] = Field(default=None)
1601
1596
  show_caption_above_media: Optional[bool] = Field(default=None)
1602
1597
  reply_markup: Optional[InlineKeyboardMarkup] = Field(default=None)
1603
- input_message_content: Optional[_InputMessageContent] = Field(default=None)
1598
+ input_message_content: Optional[InputMessageContent] = Field(default=None)
1604
1599
 
1605
1600
  class InlineQueryResultLocation(InlineQueryResult, frozen=True):
1606
1601
  '''
@@ -1623,7 +1618,7 @@ class InlineQueryResultLocation(InlineQueryResult, frozen=True):
1623
1618
  heading: Optional[int] = Field(default=None)
1624
1619
  proximity_alert_radius: Optional[int] = Field(default=None)
1625
1620
  reply_markup: Optional[InlineKeyboardMarkup] = Field(default=None)
1626
- input_message_content: Optional[_InputMessageContent] = Field(default=None)
1621
+ input_message_content: Optional[InputMessageContent] = Field(default=None)
1627
1622
  thumbnail_url: Optional[str] = Field(default=None)
1628
1623
  thumbnail_width: Optional[int] = Field(default=None)
1629
1624
  thumbnail_height: Optional[int] = Field(default=None)
@@ -1654,7 +1649,7 @@ class InlineQueryResultMpeg4Gif(InlineQueryResult, frozen=True):
1654
1649
  caption_entities: Optional[List[MessageEntity]] = Field(default=None)
1655
1650
  show_caption_above_media: Optional[bool] = Field(default=None)
1656
1651
  reply_markup: Optional[InlineKeyboardMarkup] = Field(default=None)
1657
- input_message_content: Optional[_InputMessageContent] = Field(default=None)
1652
+ input_message_content: Optional[InputMessageContent] = Field(default=None)
1658
1653
 
1659
1654
  class InlineQueryResultPhoto(InlineQueryResult, frozen=True):
1660
1655
  '''
@@ -1680,7 +1675,7 @@ class InlineQueryResultPhoto(InlineQueryResult, frozen=True):
1680
1675
  caption_entities: Optional[List[MessageEntity]] = Field(default=None)
1681
1676
  show_caption_above_media: Optional[bool] = Field(default=None)
1682
1677
  reply_markup: Optional[InlineKeyboardMarkup] = Field(default=None)
1683
- input_message_content: Optional[_InputMessageContent] = Field(default=None)
1678
+ input_message_content: Optional[InputMessageContent] = Field(default=None)
1684
1679
 
1685
1680
  class InlineQueryResultVenue(InlineQueryResult, frozen=True):
1686
1681
  '''
@@ -1703,7 +1698,7 @@ class InlineQueryResultVenue(InlineQueryResult, frozen=True):
1703
1698
  google_place_id: Optional[str] = Field(default=None)
1704
1699
  google_place_type: Optional[str] = Field(default=None)
1705
1700
  reply_markup: Optional[InlineKeyboardMarkup] = Field(default=None)
1706
- input_message_content: Optional[_InputMessageContent] = Field(default=None)
1701
+ input_message_content: Optional[InputMessageContent] = Field(default=None)
1707
1702
  thumbnail_url: Optional[str] = Field(default=None)
1708
1703
  thumbnail_width: Optional[int] = Field(default=None)
1709
1704
  thumbnail_height: Optional[int] = Field(default=None)
@@ -1735,7 +1730,7 @@ class InlineQueryResultVideo(InlineQueryResult, frozen=True):
1735
1730
  video_duration: Optional[int] = Field(default=None)
1736
1731
  description: Optional[str] = Field(default=None)
1737
1732
  reply_markup: Optional[InlineKeyboardMarkup] = Field(default=None)
1738
- input_message_content: Optional[_InputMessageContent] = Field(default=None)
1733
+ input_message_content: Optional[InputMessageContent] = Field(default=None)
1739
1734
 
1740
1735
  class InlineQueryResultVoice(InlineQueryResult, frozen=True):
1741
1736
  '''
@@ -1758,7 +1753,7 @@ class InlineQueryResultVoice(InlineQueryResult, frozen=True):
1758
1753
  caption_entities: Optional[List[MessageEntity]] = Field(default=None)
1759
1754
  voice_duration: Optional[int] = Field(default=None)
1760
1755
  reply_markup: Optional[InlineKeyboardMarkup] = Field(default=None)
1761
- input_message_content: Optional[_InputMessageContent] = Field(default=None)
1756
+ input_message_content: Optional[InputMessageContent] = Field(default=None)
1762
1757
 
1763
1758
  _InlineQueryResult = Union[
1764
1759
  InlineQueryResultCachedAudio,
@@ -1943,7 +1938,7 @@ class TransactionPartnerUser(TransactionPartner, frozen=True):
1943
1938
  affiliate: Optional[AffiliateInfo] = Field(default=None)
1944
1939
  invoice_payload: Optional[str] = Field(default=None)
1945
1940
  subscription_period: Optional[int] = Field(default=None)
1946
- paid_media: Optional[List[_PaidMedia]] = Field(default=None)
1941
+ paid_media: Optional[List[PaidMedia]] = Field(default=None)
1947
1942
  paid_media_payload: Optional[str] = Field(default=None)
1948
1943
  gift: Optional[Gift] = Field(default=None)
1949
1944
  premium_subscription_duration: Optional[int] = Field(default=None)
@@ -1979,7 +1974,7 @@ class TransactionPartnerFragment(TransactionPartner, frozen=True):
1979
1974
  '''
1980
1975
 
1981
1976
  type: Literal['fragment'] = 'fragment'
1982
- withdrawal_state: Optional[_RevenueWithdrawalState] = Field(default=None)
1977
+ withdrawal_state: Optional[RevenueWithdrawalState] = Field(default=None)
1983
1978
 
1984
1979
  class TransactionPartnerTelegramAds(TransactionPartner, frozen=True):
1985
1980
  '''
@@ -2250,7 +2245,8 @@ class User(BaseModel, frozen=True):
2250
2245
  can_read_all_group_messages: Optional[bool] = Field(default=None)
2251
2246
  supports_inline_queries: Optional[bool] = Field(default=None)
2252
2247
  can_connect_to_business: Optional[bool] = Field(default=None)
2253
- has_main_web_app: Optional[bool] = Field(default=None)
2248
+ has_main_web_app: Optional[bool] = Field(default=None)
2249
+ has_topics_enabled: Optional[bool] = Field(default=None)
2254
2250
 
2255
2251
  class Chat(BaseModel, frozen=True):
2256
2252
  '''
@@ -2294,7 +2290,7 @@ class ChatFullInfo(BaseModel, frozen=True):
2294
2290
  business_opening_hours: Optional[BusinessOpeningHours] = Field(default=None)
2295
2291
  personal_chat: Optional[Chat] = Field(default=None)
2296
2292
  parent_chat: Optional[Chat] = Field(default=None)
2297
- available_reactions: Optional[List[_ReactionType]] = Field(default=None)
2293
+ available_reactions: Optional[List[ReactionType]] = Field(default=None)
2298
2294
  background_custom_emoji_id: Optional[str] = Field(default=None)
2299
2295
  profile_accent_color_id: Optional[int] = Field(default=None)
2300
2296
  profile_background_custom_emoji_id: Optional[str] = Field(default=None)
@@ -2321,7 +2317,10 @@ class ChatFullInfo(BaseModel, frozen=True):
2321
2317
  can_set_sticker_set: Optional[bool] = Field(default=None)
2322
2318
  custom_emoji_sticker_set_name: Optional[str] = Field(default=None)
2323
2319
  linked_chat_id: Optional[int] = Field(default=None)
2324
- location: Optional[ChatLocation] = Field(default=None)
2320
+ location: Optional[ChatLocation] = Field(default=None)
2321
+ rating: Optional[UserRating] = Field(default=None)
2322
+ unique_gift_colors: Optional[UniqueGiftColors] = Field(default=None)
2323
+ paid_message_star_count: Optional[int] = Field(default=None)
2325
2324
 
2326
2325
  class MessageId(BaseModel, frozen=True):
2327
2326
  '''
@@ -2390,7 +2389,7 @@ class ExternalReplyInfo(BaseModel, frozen=True):
2390
2389
  Reference: https://core.telegram.org/bots/api#externalreplyinfo
2391
2390
  '''
2392
2391
 
2393
- origin: _MessageOrigin
2392
+ origin: MessageOrigin
2394
2393
  chat: Optional[Chat] = Field(default=None)
2395
2394
  message_id: Optional[int] = Field(default=None)
2396
2395
  link_preview_options: Optional[LinkPreviewOptions] = Field(default=None)
@@ -2563,7 +2562,7 @@ class PaidMediaInfo(BaseModel, frozen=True):
2563
2562
  '''
2564
2563
 
2565
2564
  star_count: int
2566
- paid_media: List[_PaidMedia]
2565
+ paid_media: List[PaidMedia]
2567
2566
 
2568
2567
  class Contact(BaseModel, frozen=True):
2569
2568
  '''
@@ -2659,6 +2658,7 @@ class ChecklistTask(BaseModel, frozen=True):
2659
2658
  text: str
2660
2659
  text_entities: Optional[List[MessageEntity]] = Field(default=None)
2661
2660
  completed_by_user: Optional[User] = Field(default=None)
2661
+ completed_by_chat: Optional[Chat] = Field(default=None)
2662
2662
  completion_date: Optional[int] = Field(default=None)
2663
2663
 
2664
2664
  class Checklist(BaseModel, frozen=True):
@@ -2803,7 +2803,7 @@ class ChatBackground(BaseModel, frozen=True):
2803
2803
  Reference: https://core.telegram.org/bots/api#chatbackground
2804
2804
  '''
2805
2805
 
2806
- type: _BackgroundType
2806
+ type: BackgroundType
2807
2807
 
2808
2808
  class ForumTopicCreated(BaseModel, frozen=True):
2809
2809
  '''
@@ -2815,7 +2815,8 @@ class ForumTopicCreated(BaseModel, frozen=True):
2815
2815
 
2816
2816
  name: str
2817
2817
  icon_color: int
2818
- icon_custom_emoji_id: Optional[str] = Field(default=None)
2818
+ icon_custom_emoji_id: Optional[str] = Field(default=None)
2819
+ is_name_implicit: Optional[bool] = Field(default=None)
2819
2820
 
2820
2821
  class ForumTopicClosed(BaseModel, frozen=True):
2821
2822
  '''
@@ -3425,7 +3426,7 @@ class CallbackQuery(BaseModel, frozen=True):
3425
3426
  id: str
3426
3427
  from_user: User = Field(alias='from') # FIX `from` is a python reserved keyword
3427
3428
  chat_instance: str
3428
- message: Optional[_MaybeInaccessibleMessage] = Field(default=None)
3429
+ message: Optional[MaybeInaccessibleMessage] = Field(default=None)
3429
3430
  inline_message_id: Optional[str] = Field(default=None)
3430
3431
  data: Optional[str] = Field(default=None)
3431
3432
  game_short_name: Optional[str] = Field(default=None)
@@ -3515,8 +3516,8 @@ class ChatMemberUpdated(BaseModel, frozen=True):
3515
3516
  chat: Chat
3516
3517
  from_user: User = Field(alias='from') # FIX `from` is a python reserved keyword
3517
3518
  date: int
3518
- old_chat_member: _ChatMember
3519
- new_chat_member: _ChatMember
3519
+ old_chat_member: ChatMember
3520
+ new_chat_member: ChatMember
3520
3521
  invite_link: Optional[ChatInviteLink] = Field(default=None)
3521
3522
  via_join_request: Optional[bool] = Field(default=None)
3522
3523
  via_chat_folder_invite_link: Optional[bool] = Field(default=None)
@@ -3638,6 +3639,19 @@ class BusinessOpeningHours(BaseModel, frozen=True):
3638
3639
  time_zone_name: str
3639
3640
  opening_hours: List[BusinessOpeningHoursInterval]
3640
3641
 
3642
+ class UserRating(BaseModel, frozen=True):
3643
+ '''
3644
+ This object describes the rating of a user
3645
+ based on their Telegram Star spendings.
3646
+
3647
+ Reference: https://core.telegram.org/bots/api#userrating
3648
+ '''
3649
+
3650
+ level: int
3651
+ rating: int
3652
+ current_level_rating: int
3653
+ next_level_rating: Optional[int] = Field(default=None)
3654
+
3641
3655
  class StoryAreaPosition(BaseModel, frozen=True):
3642
3656
  '''
3643
3657
  Describes the position of a clickable area within
@@ -3673,7 +3687,7 @@ class StoryArea(BaseModel, frozen=True):
3673
3687
  '''
3674
3688
 
3675
3689
  position: StoryAreaPosition
3676
- type: _StoryAreaType
3690
+ type: StoryAreaType
3677
3691
 
3678
3692
  class ChatLocation(BaseModel, frozen=True):
3679
3693
  '''
@@ -3694,7 +3708,7 @@ class ReactionCount(BaseModel, frozen=True):
3694
3708
  Reference: https://core.telegram.org/bots/api#reactioncount
3695
3709
  '''
3696
3710
 
3697
- type: _ReactionType
3711
+ type: ReactionType
3698
3712
  total_count: int
3699
3713
 
3700
3714
  class MessageReactionUpdated(BaseModel, frozen=True):
@@ -3708,8 +3722,8 @@ class MessageReactionUpdated(BaseModel, frozen=True):
3708
3722
  chat: Chat
3709
3723
  message_id: int
3710
3724
  date: int
3711
- old_reaction: List[_ReactionType]
3712
- new_reaction: List[_ReactionType]
3725
+ old_reaction: List[ReactionType]
3726
+ new_reaction: List[ReactionType]
3713
3727
  user: Optional[User] = Field(default=None)
3714
3728
  actor_chat: Optional[Chat] = Field(default=None)
3715
3729
 
@@ -3736,7 +3750,19 @@ class ForumTopic(BaseModel, frozen=True):
3736
3750
  message_thread_id: int
3737
3751
  name: str
3738
3752
  icon_color: int
3739
- icon_custom_emoji_id: Optional[str] = Field(default=None)
3753
+ icon_custom_emoji_id: Optional[str] = Field(default=None)
3754
+ is_name_implicit: Optional[bool] = Field(default=None)
3755
+
3756
+ class GiftBackground(BaseModel, frozen=True):
3757
+ '''
3758
+ This object describes the background of a gift.
3759
+
3760
+ Reference: https://core.telegram.org/bots/api#giftbackground
3761
+ '''
3762
+
3763
+ center_color: int
3764
+ edge_color: int
3765
+ text_color: int
3740
3766
 
3741
3767
  class Gift(BaseModel, frozen=True):
3742
3768
  '''
@@ -3750,8 +3776,14 @@ class Gift(BaseModel, frozen=True):
3750
3776
  sticker: Sticker
3751
3777
  star_count: int
3752
3778
  upgrade_star_count: Optional[int] = Field(default=None)
3779
+ is_premium: Optional[bool] = Field(default=None)
3780
+ has_colors: Optional[bool] = Field(default=None)
3753
3781
  total_count: Optional[int] = Field(default=None)
3754
3782
  remaining_count: Optional[int] = Field(default=None)
3783
+ personal_total_count: Optional[int] = Field(default=None)
3784
+ personal_remaining_count: Optional[int] = Field(default=None)
3785
+ background: Optional[GiftBackground] = Field(default=None)
3786
+ unique_gift_variant_count: Optional[int] = Field(default=None)
3755
3787
  publisher_chat: Optional[Chat] = Field(default=None)
3756
3788
 
3757
3789
  class Gifts(BaseModel, frozen=True):
@@ -3812,6 +3844,22 @@ class UniqueGiftBackdrop(BaseModel, frozen=True):
3812
3844
  colors: UniqueGiftBackdropColors
3813
3845
  rarity_per_mille: int
3814
3846
 
3847
+ class UniqueGiftColors(BaseModel, frozen=True):
3848
+ '''
3849
+ This object contains information about the color scheme
3850
+ for a user's name, message replies and link
3851
+ previews based on a unique gift.
3852
+
3853
+ Reference: https://core.telegram.org/bots/api#uniquegiftcolors
3854
+ '''
3855
+
3856
+ model_custom_emoji_id: str
3857
+ symbol_custom_emoji_id: str
3858
+ light_theme_main_color: int
3859
+ light_theme_other_colors: List[int]
3860
+ dark_theme_main_color: int
3861
+ dark_theme_other_colors: List[int]
3862
+
3815
3863
  class UniqueGift(BaseModel, frozen=True):
3816
3864
  '''
3817
3865
  This object describes a unique gift that was
@@ -3820,12 +3868,16 @@ class UniqueGift(BaseModel, frozen=True):
3820
3868
  Reference: https://core.telegram.org/bots/api#uniquegift
3821
3869
  '''
3822
3870
 
3871
+ gift_id: str
3823
3872
  base_name: str
3824
3873
  name: str
3825
3874
  number: int
3826
3875
  model: UniqueGiftModel
3827
3876
  symbol: UniqueGiftSymbol
3828
3877
  backdrop: UniqueGiftBackdrop
3878
+ is_premium: Optional[bool] = Field(default=None)
3879
+ is_from_blockchain: Optional[bool] = Field(default=None)
3880
+ colors: Optional[UniqueGiftColors] = Field(default=None)
3829
3881
  publisher_chat: Optional[Chat] = Field(default=None)
3830
3882
 
3831
3883
  class GiftInfo(BaseModel, frozen=True):
@@ -3840,10 +3892,12 @@ class GiftInfo(BaseModel, frozen=True):
3840
3892
  owned_gift_id: Optional[str] = Field(default=None)
3841
3893
  convert_star_count: Optional[int] = Field(default=None)
3842
3894
  prepaid_upgrade_star_count: Optional[int] = Field(default=None)
3895
+ is_upgrade_separate: Optional[bool] = Field(default=None)
3843
3896
  can_be_upgraded: Optional[bool] = Field(default=None)
3844
3897
  text: Optional[str] = Field(default=None)
3845
3898
  entities: Optional[List[MessageEntity]] = Field(default=None)
3846
- is_private: Optional[bool] = Field(default=None)
3899
+ is_private: Optional[bool] = Field(default=None)
3900
+ unique_gift_number: Optional[int] = Field(default=None)
3847
3901
 
3848
3902
  class UniqueGiftInfo(BaseModel, frozen=True):
3849
3903
  '''
@@ -3855,7 +3909,8 @@ class UniqueGiftInfo(BaseModel, frozen=True):
3855
3909
 
3856
3910
  gift: UniqueGift
3857
3911
  origin: str
3858
- last_resale_star_count: Optional[int] = Field(default=None)
3912
+ last_resale_currency: Optional[str] = Field(default=None)
3913
+ last_resale_amount: Optional[int] = Field(default=None)
3859
3914
  owned_gift_id: Optional[str] = Field(default=None)
3860
3915
  transfer_star_count: Optional[int] = Field(default=None)
3861
3916
  next_transfer_date: Optional[int] = Field(default=None)
@@ -3869,7 +3924,7 @@ class OwnedGifts(BaseModel, frozen=True):
3869
3924
  '''
3870
3925
 
3871
3926
  total_count: int
3872
- gifts: List[_OwnedGift]
3927
+ gifts: List[OwnedGift]
3873
3928
  next_offset: Optional[str] = Field(default=None)
3874
3929
 
3875
3930
  class AcceptedGiftTypes(BaseModel, frozen=True):
@@ -3884,7 +3939,8 @@ class AcceptedGiftTypes(BaseModel, frozen=True):
3884
3939
  unlimited_gifts: bool
3885
3940
  limited_gifts: bool
3886
3941
  unique_gifts: bool
3887
- premium_subscription: bool
3942
+ premium_subscription: bool
3943
+ gifts_from_channels: bool
3888
3944
 
3889
3945
  class StarAmount(BaseModel, frozen=True):
3890
3946
  '''
@@ -3943,7 +3999,7 @@ class ChatBoost(BaseModel, frozen=True):
3943
3999
  boost_id: str
3944
4000
  add_date: int
3945
4001
  expiration_date: int
3946
- source: _ChatBoostSource
4002
+ source: ChatBoostSource
3947
4003
 
3948
4004
  class ChatBoostUpdated(BaseModel, frozen=True):
3949
4005
  '''
@@ -3967,7 +4023,7 @@ class ChatBoostRemoved(BaseModel, frozen=True):
3967
4023
  chat: Chat
3968
4024
  boost_id: str
3969
4025
  remove_date: int
3970
- source: _ChatBoostSource
4026
+ source: ChatBoostSource
3971
4027
 
3972
4028
  class UserChatBoosts(BaseModel, frozen=True):
3973
4029
  '''
@@ -4348,8 +4404,8 @@ class StarTransaction(BaseModel, frozen=True):
4348
4404
  amount: int
4349
4405
  date: int
4350
4406
  nanostar_amount: Optional[int] = Field(default=None)
4351
- source: Optional[_TransactionPartner] = Field(default=None)
4352
- receiver: Optional[_TransactionPartner] = Field(default=None)
4407
+ source: Optional[TransactionPartner] = Field(default=None)
4408
+ receiver: Optional[TransactionPartner] = Field(default=None)
4353
4409
 
4354
4410
  class StarTransactions(BaseModel, frozen=True):
4355
4411
  '''
@@ -4461,3 +4517,5 @@ IntAdapter = TypeAdapter[int](int)
4461
4517
  StrAdapter = TypeAdapter[str](str)
4462
4518
  FloatAdapter = TypeAdapter[float](float)
4463
4519
  BoolAdapter = TypeAdapter[bool](bool)
4520
+
4521
+ MediaTypeUnion = Union[Animation, Audio, Document, List[PhotoSize], Sticker, Video, VideoNote, Voice, Story, PaidMedia]
File without changes
File without changes
File without changes