botapi-py 1.5.12__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.12
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.12"
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(
@@ -427,7 +427,7 @@ class InaccessibleMessage(MaybeInaccessibleMessage):
427
427
  message_id: int
428
428
  date: int
429
429
 
430
- _MaybeInaccessibleMessage = Union[
430
+ type _MaybeInaccessibleMessage = Union[
431
431
  Message,
432
432
  InaccessibleMessage,
433
433
  ]
@@ -488,7 +488,7 @@ class MessageOriginChannel(MessageOrigin):
488
488
  message_id: int
489
489
  author_signature: Optional[str] = Field(default=None)
490
490
 
491
- _MessageOrigin = Union[
491
+ type _MessageOrigin = Union[
492
492
  MessageOriginUser,
493
493
  MessageOriginHiddenUser,
494
494
  MessageOriginChat,
@@ -541,7 +541,7 @@ class PaidMediaVideo(PaidMedia):
541
541
  type: Literal['video'] = 'video' # pyright: ignore[reportIncompatibleVariableOverride]
542
542
  video: Video
543
543
 
544
- _PaidMedia = Union[
544
+ type _PaidMedia = Union[
545
545
  PaidMediaLivePhoto,
546
546
  PaidMediaPhoto,
547
547
  PaidMediaPreview,
@@ -687,7 +687,7 @@ class InputMediaVideo(InputPollMedia):
687
687
  supports_streaming: Optional[bool] = Field(default=None)
688
688
  has_spoiler: Optional[bool] = Field(default=None)
689
689
 
690
- _InputPollMedia = Union[
690
+ type _InputPollMedia = Union[
691
691
  InputMediaAnimation,
692
692
  InputMediaAudio,
693
693
  InputMediaDocument,
@@ -723,7 +723,7 @@ class InputMediaSticker(InputPollOptionMedia):
723
723
  media: Union[InputFile, str]
724
724
  emoji: Optional[str] = Field(default=None)
725
725
 
726
- _InputPollOptionMedia = Union[
726
+ type _InputPollOptionMedia = Union[
727
727
  InputMediaAnimation,
728
728
  InputMediaLink,
729
729
  InputMediaLivePhoto,
@@ -771,7 +771,7 @@ class BackgroundFillFreeformGradient(BackgroundFill):
771
771
  type: Literal['freeform_gradient'] = 'freeform_gradient' # pyright: ignore[reportIncompatibleVariableOverride]
772
772
  colors: List[int]
773
773
 
774
- _BackgroundFill = Union[
774
+ type _BackgroundFill = Union[
775
775
  BackgroundFillSolid,
776
776
  BackgroundFillGradient,
777
777
  BackgroundFillFreeformGradient,
@@ -835,7 +835,7 @@ class BackgroundTypeChatTheme(BackgroundType):
835
835
  type: Literal['chat_theme'] = 'chat_theme' # pyright: ignore[reportIncompatibleVariableOverride]
836
836
  theme_name: str
837
837
 
838
- _BackgroundType = Union[
838
+ type _BackgroundType = Union[
839
839
  BackgroundTypeFill,
840
840
  BackgroundTypeWallpaper,
841
841
  BackgroundTypePattern,
@@ -1089,7 +1089,7 @@ class ChatMemberBanned(ChatMember):
1089
1089
  user: User
1090
1090
  until_date: int
1091
1091
 
1092
- _ChatMember = Union[
1092
+ type _ChatMember = Union[
1093
1093
  ChatMemberOwner,
1094
1094
  ChatMemberAdministrator,
1095
1095
  ChatMemberMember,
@@ -1168,7 +1168,7 @@ class StoryAreaTypeUniqueGift(StoryAreaType):
1168
1168
  type: Literal['unique_gift'] = 'unique_gift' # pyright: ignore[reportIncompatibleVariableOverride]
1169
1169
  name: str
1170
1170
 
1171
- _StoryAreaType = Union[
1171
+ type _StoryAreaType = Union[
1172
1172
  StoryAreaTypeLocation,
1173
1173
  StoryAreaTypeSuggestedReaction,
1174
1174
  StoryAreaTypeLink,
@@ -1209,7 +1209,7 @@ class ReactionTypePaid(ReactionType):
1209
1209
 
1210
1210
  type: Literal['paid'] = 'paid' # pyright: ignore[reportIncompatibleVariableOverride]
1211
1211
 
1212
- _ReactionType = Union[
1212
+ type _ReactionType = Union[
1213
1213
  ReactionTypeEmoji,
1214
1214
  ReactionTypeCustomEmoji,
1215
1215
  ReactionTypePaid,
@@ -1265,7 +1265,7 @@ class OwnedGiftUnique(OwnedGift):
1265
1265
  transfer_star_count: Optional[int] = Field(default=None)
1266
1266
  next_transfer_date: Optional[int] = Field(default=None)
1267
1267
 
1268
- _OwnedGift = Union[
1268
+ type _OwnedGift = Union[
1269
1269
  OwnedGiftRegular,
1270
1270
  OwnedGiftUnique,
1271
1271
  ]
@@ -1349,7 +1349,7 @@ class BotCommandScopeChatMember(BotCommandScope):
1349
1349
  chat_id: Union[int, str]
1350
1350
  user_id: int
1351
1351
 
1352
- _BotCommandScope = Union[
1352
+ type _BotCommandScope = Union[
1353
1353
  BotCommandScopeDefault,
1354
1354
  BotCommandScopeAllPrivateChats,
1355
1355
  BotCommandScopeAllGroupChats,
@@ -1395,7 +1395,7 @@ class MenuButtonDefault(MenuButton):
1395
1395
 
1396
1396
  type: Literal['default'] = 'default' # pyright: ignore[reportIncompatibleVariableOverride]
1397
1397
 
1398
- _MenuButton = Union[
1398
+ type _MenuButton = Union[
1399
1399
  MenuButtonCommands,
1400
1400
  MenuButtonWebApp,
1401
1401
  MenuButtonDefault,
@@ -1449,7 +1449,7 @@ class ChatBoostSourceGiveaway(ChatBoostSource):
1449
1449
  prize_star_count: Optional[int] = Field(default=None)
1450
1450
  is_unclaimed: Optional[bool] = Field(default=None)
1451
1451
 
1452
- _ChatBoostSource = Union[
1452
+ type _ChatBoostSource = Union[
1453
1453
  ChatBoostSourcePremium,
1454
1454
  ChatBoostSourceGiftCode,
1455
1455
  ChatBoostSourceGiveaway,
@@ -1463,7 +1463,7 @@ class InputMedia(BaseModel):
1463
1463
  parse_mode: Optional[str] = Field(default=None)
1464
1464
  caption_entities: Optional[List[MessageEntity]] = Field(default=None)
1465
1465
 
1466
- _InputMedia = Union[
1466
+ type _InputMedia = Union[
1467
1467
  InputMediaAnimation,
1468
1468
  InputMediaAudio,
1469
1469
  InputMediaDocument,
@@ -1516,7 +1516,7 @@ class InputPaidMediaVideo(InputPaidMedia):
1516
1516
  duration: Optional[int] = Field(default=None)
1517
1517
  supports_streaming: Optional[bool] = Field(default=None)
1518
1518
 
1519
- _InputPaidMedia = Union[
1519
+ type _InputPaidMedia = Union[
1520
1520
  InputPaidMediaLivePhoto,
1521
1521
  InputPaidMediaPhoto,
1522
1522
  InputPaidMediaVideo,
@@ -1547,7 +1547,7 @@ class InputProfilePhotoAnimated(InputProfilePhoto):
1547
1547
  animation: Union[InputFile, str]
1548
1548
  main_frame_timestamp: Optional[float] = Field(default=None)
1549
1549
 
1550
- _InputProfilePhoto = Union[
1550
+ type _InputProfilePhoto = Union[
1551
1551
  InputProfilePhotoStatic,
1552
1552
  InputProfilePhotoAnimated,
1553
1553
  ]
@@ -1579,7 +1579,7 @@ class InputStoryContentVideo(InputStoryContent):
1579
1579
  cover_frame_timestamp: Optional[float] = Field(default=None)
1580
1580
  is_animation: Optional[bool] = Field(default=None)
1581
1581
 
1582
- _InputStoryContent = Union[
1582
+ type _InputStoryContent = Union[
1583
1583
  InputStoryContentPhoto,
1584
1584
  InputStoryContentVideo,
1585
1585
  ]
@@ -1864,7 +1864,7 @@ class RichTextReferenceLink(RichText):
1864
1864
  text: _RichText
1865
1865
  reference_name: str
1866
1866
 
1867
- _RichText = Union[
1867
+ type _RichText = Union[
1868
1868
  RichTextBold,
1869
1869
  RichTextItalic,
1870
1870
  RichTextUnderline,
@@ -1891,6 +1891,8 @@ _RichText = Union[
1891
1891
  RichTextAnchorLink,
1892
1892
  RichTextReference,
1893
1893
  RichTextReferenceLink,
1894
+ str,
1895
+ List[_RichText],
1894
1896
  ]
1895
1897
  RichTextAdapter = TypeAdapter[_RichText](_RichText)
1896
1898
 
@@ -2000,7 +2002,7 @@ class RichBlockBlockQuotation(RichBlock):
2000
2002
  class RichBlockExpandableBlockQuotation(RichBlock):
2001
2003
  '''
2002
2004
  A block quotation, corresponding to the HTML tag
2003
- <blockquote> with custom attribute "collapsed".
2005
+ <blockquote> with custom attribute "expandable".
2004
2006
 
2005
2007
  Reference: https://core.telegram.org/bots/api#richblockexpandableblockquotation
2006
2008
  '''
@@ -2190,7 +2192,7 @@ class RichBlockThinking(RichBlock):
2190
2192
  type: Literal['thinking'] = 'thinking' # pyright: ignore[reportIncompatibleVariableOverride]
2191
2193
  text: _RichText
2192
2194
 
2193
- _RichBlock = Union[
2195
+ type _RichBlock = Union[
2194
2196
  RichBlockParagraph,
2195
2197
  RichBlockSectionHeading,
2196
2198
  RichBlockPreformatted,
@@ -2324,7 +2326,7 @@ class InputRichBlockBlockQuotation(InputRichBlock):
2324
2326
  class InputRichBlockExpandableBlockQuotation(InputRichBlock):
2325
2327
  '''
2326
2328
  A block quotation, corresponding to the HTML tag
2327
- <blockquote> with custom attribute "collapsed".
2329
+ <blockquote> with custom attribute "expandable".
2328
2330
 
2329
2331
  Reference: https://core.telegram.org/bots/api#inputrichblockexpandableblockquotation
2330
2332
  '''
@@ -2514,7 +2516,7 @@ class InputRichBlockThinking(InputRichBlock):
2514
2516
  type: Literal['thinking'] = 'thinking' # pyright: ignore[reportIncompatibleVariableOverride]
2515
2517
  text: _RichText
2516
2518
 
2517
- _InputRichBlock = Union[
2519
+ type _InputRichBlock = Union[
2518
2520
  InputRichBlockParagraph,
2519
2521
  InputRichBlockSectionHeading,
2520
2522
  InputRichBlockPreformatted,
@@ -3015,7 +3017,7 @@ class InlineQueryResultVoice(InlineQueryResult):
3015
3017
  reply_markup: Optional[InlineKeyboardMarkup] = Field(default=None)
3016
3018
  input_message_content: Optional[_InputMessageContent] = Field(default=None)
3017
3019
 
3018
- _InlineQueryResult = Union[
3020
+ type _InlineQueryResult = Union[
3019
3021
  InlineQueryResultCachedAudio,
3020
3022
  InlineQueryResultCachedDocument,
3021
3023
  InlineQueryResultCachedGif,
@@ -3145,7 +3147,7 @@ class InputInvoiceMessageContent(InputMessageContent):
3145
3147
  send_email_to_provider: Optional[bool] = Field(default=None)
3146
3148
  is_flexible: Optional[bool] = Field(default=None)
3147
3149
 
3148
- _InputMessageContent = Union[
3150
+ type _InputMessageContent = Union[
3149
3151
  InputTextMessageContent,
3150
3152
  InputRichMessageContent,
3151
3153
  InputLocationMessageContent,
@@ -3187,7 +3189,7 @@ class RevenueWithdrawalStateFailed(RevenueWithdrawalState):
3187
3189
 
3188
3190
  type: Literal['failed'] = 'failed' # pyright: ignore[reportIncompatibleVariableOverride]
3189
3191
 
3190
- _RevenueWithdrawalState = Union[
3192
+ type _RevenueWithdrawalState = Union[
3191
3193
  RevenueWithdrawalStatePending,
3192
3194
  RevenueWithdrawalStateSucceeded,
3193
3195
  RevenueWithdrawalStateFailed,
@@ -3278,7 +3280,7 @@ class TransactionPartnerOther(TransactionPartner):
3278
3280
 
3279
3281
  type: Literal['other'] = 'other' # pyright: ignore[reportIncompatibleVariableOverride]
3280
3282
 
3281
- _TransactionPartner = Union[
3283
+ type _TransactionPartner = Union[
3282
3284
  TransactionPartnerUser,
3283
3285
  TransactionPartnerChat,
3284
3286
  TransactionPartnerAffiliateProgram,
@@ -3424,7 +3426,7 @@ class PassportElementErrorUnspecified(PassportElementError):
3424
3426
  element_hash: str
3425
3427
  message: str
3426
3428
 
3427
- _PassportElementError = Union[
3429
+ type _PassportElementError = Union[
3428
3430
  PassportElementErrorDataField,
3429
3431
  PassportElementErrorFrontSide,
3430
3432
  PassportElementErrorReverseSide,
File without changes