@@ -1525,7 +1525,7 @@ def __init__(self, message_id, from_user, date, chat, content_type, options, jso
1525
1525
self .json = json_string
1526
1526
1527
1527
@property
1528
- def html_text (self ) -> str :
1528
+ def html_text (self ) -> Optional [ str ] :
1529
1529
"""
1530
1530
Returns html-rendered text.
1531
1531
"""
@@ -1534,7 +1534,7 @@ def html_text(self) -> str:
1534
1534
return apply_html_entities (self .text , self .entities , getattr (self , "custom_subs" , None ))
1535
1535
1536
1536
@property
1537
- def html_caption (self ) -> str :
1537
+ def html_caption (self ) -> Optional [ str ] :
1538
1538
"""
1539
1539
Returns html-rendered caption.
1540
1540
"""
@@ -1618,6 +1618,14 @@ def user_shared(self):
1618
1618
logger .warning ('The parameter "user_shared" is deprecated, use "users_shared" instead' )
1619
1619
return self .users_shared
1620
1620
1621
+ @property
1622
+ def any_text (self ) -> Optional [str ]:
1623
+ return self .caption if (self .caption is not None ) else self .text
1624
+
1625
+ @property
1626
+ def any_entities (self ) -> Optional [List [MessageEntity ]]:
1627
+ return self .caption_entities if (self .caption_entities is not None ) else self .entities
1628
+
1621
1629
1622
1630
# noinspection PyShadowingBuiltins
1623
1631
class MessageEntity (Dictionaryable , JsonSerializable , JsonDeserializable ):
@@ -2734,6 +2742,7 @@ def __init__(self, text: str, request_contact: Optional[bool]=None,
2734
2742
if request_user is not None :
2735
2743
logger .warning ('The parameter "request_user" is deprecated, use "request_users" instead' )
2736
2744
if self .request_users is None :
2745
+ # noinspection PyTypeChecker
2737
2746
self .request_users = request_user
2738
2747
2739
2748
@@ -4268,6 +4277,7 @@ def __init__(self, result_id, from_user, query, location=None, inline_message_id
4268
4277
self .query : str = query
4269
4278
4270
4279
4280
+ # noinspection PyShadowingBuiltins
4271
4281
class InlineQueryResultBase (ABC , Dictionaryable , JsonSerializable ):
4272
4282
"""
4273
4283
This object represents one result of an inline query. Telegram clients currently support results of the following 20 types:
@@ -5407,15 +5417,16 @@ class InlineQueryResultCachedBase(ABC, JsonSerializable):
5407
5417
Base class of all InlineQueryResultCached* classes.
5408
5418
"""
5409
5419
def __init__ (self ):
5410
- self .type : str = None
5411
- self .id : str = None
5420
+ self .type : str = ""
5421
+ self .id : str = ""
5412
5422
self .title : Optional [str ] = None
5413
5423
self .description : Optional [str ] = None
5414
5424
self .caption : Optional [str ] = None
5415
5425
self .reply_markup : Optional [InlineKeyboardMarkup ] = None
5416
5426
self .input_message_content : Optional [InputMessageContent ] = None
5417
5427
self .parse_mode : Optional [str ] = None
5418
5428
self .caption_entities : Optional [List [MessageEntity ]] = None
5429
+ # noinspection PyTypeChecker
5419
5430
self .payload_dic : Dict [str ] = {}
5420
5431
self .show_caption_above_media : Optional [bool ] = None
5421
5432
@@ -7104,6 +7115,7 @@ def to_dict(self):
7104
7115
return json_dict
7105
7116
7106
7117
7118
+ # noinspection PyShadowingBuiltins
7107
7119
class Poll (JsonDeserializable ):
7108
7120
"""
7109
7121
This object contains information about a poll.
@@ -7586,7 +7598,7 @@ def to_dict(self):
7586
7598
raise NotImplementedError
7587
7599
7588
7600
7589
- # noinspection PyUnusedLocal
7601
+ # noinspection PyUnusedLocal,PyShadowingBuiltins
7590
7602
class MenuButtonCommands (MenuButton ):
7591
7603
"""
7592
7604
Represents a menu button, which opens the bot's list of commands.
@@ -7610,7 +7622,7 @@ def to_json(self):
7610
7622
return json .dumps (self .to_dict ())
7611
7623
7612
7624
7613
- # noinspection PyUnusedLocal
7625
+ # noinspection PyUnusedLocal,PyShadowingBuiltins
7614
7626
class MenuButtonWebApp (MenuButton ):
7615
7627
"""
7616
7628
Represents a menu button, which launches a Web App.
@@ -7645,7 +7657,7 @@ def to_json(self):
7645
7657
return json .dumps (self .to_dict ())
7646
7658
7647
7659
7648
- # noinspection PyUnusedLocal
7660
+ # noinspection PyUnusedLocal,PyShadowingBuiltins
7649
7661
class MenuButtonDefault (MenuButton ):
7650
7662
"""
7651
7663
Describes that no specific value for the menu button was set.
@@ -8202,7 +8214,7 @@ def to_dict(self) -> dict:
8202
8214
def to_json (self ) -> str :
8203
8215
return json .dumps (self .to_dict ())
8204
8216
8205
- def convert_input_sticker (self ) -> Tuple [dict , Optional [dict ]]:
8217
+ def convert_input_sticker (self ) -> Tuple [str , Optional [dict ]]:
8206
8218
if service_utils .is_string (self .sticker ):
8207
8219
return self .to_json (), None
8208
8220
@@ -8343,6 +8355,7 @@ def to_json(self) -> str:
8343
8355
return json .dumps (self .to_dict ())
8344
8356
8345
8357
8358
+ # noinspection PyShadowingBuiltins
8346
8359
class Story (JsonDeserializable ):
8347
8360
"""
8348
8361
This object represents a story.
@@ -9250,12 +9263,12 @@ def __init__(self, request_id: int, users: List[SharedUser], **kwargs):
9250
9263
self .users : List [SharedUser ] = users
9251
9264
9252
9265
@property
9253
- def user_id (self ) -> int :
9266
+ def user_id (self ) -> None :
9254
9267
logger .warning ('The parameter "user_id" is deprecated, use "user_ids" instead' )
9255
9268
return None
9256
9269
9257
9270
@property
9258
- def user_ids (self ) -> List [int ]:
9271
+ def user_ids (self ) -> List [SharedUser ]:
9259
9272
logger .warning ('The parameter "user_ids" is deprecated, use "users" instead' )
9260
9273
return self .users
9261
9274
@@ -10217,8 +10230,9 @@ def de_json(cls, json_string):
10217
10230
elif obj ["type" ] == "failed" :
10218
10231
return RevenueWithdrawalStateFailed .de_json (obj )
10219
10232
return None
10220
-
10221
10233
10234
+
10235
+ # noinspection PyShadowingBuiltins
10222
10236
class RevenueWithdrawalStatePending (RevenueWithdrawalState ):
10223
10237
"""
10224
10238
The withdrawal is in progress.
@@ -10232,7 +10246,6 @@ class RevenueWithdrawalStatePending(RevenueWithdrawalState):
10232
10246
:rtype: :class:`RevenueWithdrawalStatePending`
10233
10247
"""
10234
10248
10235
- # noinspection PyPackageRequirements
10236
10249
def __init__ (self , type , ** kwargs ):
10237
10250
self .type : str = type
10238
10251
@@ -10243,6 +10256,7 @@ def de_json(cls, json_string):
10243
10256
return cls (** obj )
10244
10257
10245
10258
10259
+ # noinspection PyShadowingBuiltins
10246
10260
class RevenueWithdrawalStateSucceeded (RevenueWithdrawalState ):
10247
10261
"""
10248
10262
The withdrawal succeeded.
@@ -10262,7 +10276,6 @@ class RevenueWithdrawalStateSucceeded(RevenueWithdrawalState):
10262
10276
:rtype: :class:`RevenueWithdrawalStateSucceeded`
10263
10277
"""
10264
10278
10265
- # noinspection PyPackageRequirements
10266
10279
def __init__ (self , type , date , url , ** kwargs ):
10267
10280
self .type : str = type
10268
10281
self .date : int = date
@@ -10273,9 +10286,9 @@ def de_json(cls, json_string):
10273
10286
if json_string is None : return None
10274
10287
obj = cls .check_json (json_string )
10275
10288
return cls (** obj )
10276
-
10277
10289
10278
-
10290
+
10291
+ # noinspection PyShadowingBuiltins
10279
10292
class RevenueWithdrawalStateFailed (RevenueWithdrawalState ):
10280
10293
"""
10281
10294
The withdrawal failed and the transaction was refunded.
@@ -10289,7 +10302,6 @@ class RevenueWithdrawalStateFailed(RevenueWithdrawalState):
10289
10302
:rtype: :class:`RevenueWithdrawalStateFailed`
10290
10303
"""
10291
10304
10292
- # noinspection PyPackageRequirements
10293
10305
def __init__ (self , type , ** kwargs ):
10294
10306
self .type : str = type
10295
10307
@@ -10329,7 +10341,9 @@ def de_json(cls, json_string):
10329
10341
return TransactionPartnerTelegramAds .de_json (obj )
10330
10342
elif obj ["type" ] == "other" :
10331
10343
return TransactionPartnerOther .de_json (obj )
10332
-
10344
+
10345
+
10346
+ # noinspection PyShadowingBuiltins
10333
10347
class TransactionPartnerFragment (TransactionPartner ):
10334
10348
"""
10335
10349
Describes a withdrawal transaction with Fragment.
@@ -10347,7 +10361,6 @@ class TransactionPartnerFragment(TransactionPartner):
10347
10361
10348
10362
"""
10349
10363
10350
- # noinspection PyPackageRequirements
10351
10364
def __init__ (self , type , withdrawal_state = None , ** kwargs ):
10352
10365
self .type : str = type
10353
10366
self .withdrawal_state : Optional [RevenueWithdrawalState ] = withdrawal_state
@@ -10359,9 +10372,9 @@ def de_json(cls, json_string):
10359
10372
if 'withdrawal_state' in obj :
10360
10373
obj ['withdrawal_state' ] = RevenueWithdrawalState .de_json (obj ['withdrawal_state' ])
10361
10374
return cls (** obj )
10362
-
10363
10375
10364
10376
10377
+ # noinspection PyShadowingBuiltins
10365
10378
class TransactionPartnerUser (TransactionPartner ):
10366
10379
"""
10367
10380
Describes a transaction with a user.
@@ -10392,7 +10405,9 @@ def de_json(cls, json_string):
10392
10405
obj = cls .check_json (json_string )
10393
10406
obj ['user' ] = User .de_json (obj ['user' ])
10394
10407
return cls (** obj )
10395
-
10408
+
10409
+
10410
+ # noinspection PyShadowingBuiltins
10396
10411
class TransactionPartnerTelegramAds (TransactionPartner ):
10397
10412
"""
10398
10413
Describes a transaction with Telegram Ads.
@@ -10413,8 +10428,10 @@ def __init__(self, type, **kwargs):
10413
10428
def de_json (cls , json_string ):
10414
10429
if json_string is None : return None
10415
10430
obj = cls .check_json (json_string )
10416
-
10417
-
10431
+ return obj
10432
+
10433
+
10434
+ # noinspection PyShadowingBuiltins
10418
10435
class TransactionPartnerOther (TransactionPartner ):
10419
10436
"""
10420
10437
Describes a transaction with an unknown source or recipient.
@@ -10436,9 +10453,9 @@ def de_json(cls, json_string):
10436
10453
if json_string is None : return None
10437
10454
obj = cls .check_json (json_string )
10438
10455
return cls (** obj )
10439
-
10440
10456
10441
10457
10458
+ # noinspection PyShadowingBuiltins
10442
10459
class StarTransaction (JsonDeserializable ):
10443
10460
"""
10444
10461
Describes a Telegram Star transaction.
@@ -10531,7 +10548,9 @@ def de_json(cls, json_string):
10531
10548
return PaidMediaPhoto .de_json (obj )
10532
10549
elif obj ["type" ] == "video" :
10533
10550
return PaidMediaVideo .de_json (obj )
10534
-
10551
+
10552
+
10553
+ # noinspection PyShadowingBuiltins
10535
10554
class PaidMediaPreview (PaidMedia ):
10536
10555
"""
10537
10556
The paid media isn't available before the payment.
@@ -10565,8 +10584,9 @@ def de_json(cls, json_string):
10565
10584
if json_string is None : return None
10566
10585
obj = cls .check_json (json_string )
10567
10586
return cls (** obj )
10568
-
10569
10587
10588
+
10589
+ # noinspection PyShadowingBuiltins
10570
10590
class PaidMediaPhoto (PaidMedia ):
10571
10591
"""
10572
10592
The paid media is a photo.
@@ -10595,8 +10615,9 @@ def de_json(cls, json_string):
10595
10615
10596
10616
obj ['photo' ] = [PhotoSize .de_json (photo ) for photo in obj ['photo' ]]
10597
10617
return cls (** obj )
10598
-
10599
10618
10619
+
10620
+ # noinspection PyShadowingBuiltins
10600
10621
class PaidMediaVideo (PaidMedia ):
10601
10622
"""
10602
10623
The paid media is a video.
@@ -10653,6 +10674,7 @@ def __init__(self, star_count, paid_media, **kwargs):
10653
10674
self .paid_media : List [PaidMedia ] = paid_media
10654
10675
10655
10676
10677
+ # noinspection PyShadowingBuiltins
10656
10678
class InputPaidMedia (JsonSerializable ):
10657
10679
"""
10658
10680
This object describes the paid media to be sent. Currently, it can be one of
0 commit comments