Skip to content

Commit d3d7a52

Browse files
Fix missing parameters, inconsistent descriptions, content type services
1 parent 3fad50d commit d3d7a52

File tree

4 files changed

+29
-17
lines changed

4 files changed

+29
-17
lines changed

telebot/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2010,14 +2010,14 @@ def copy_message(
20102010
))
20112011

20122012

2013-
def approve_suggested_post(self, chat_id: Union[int, str], message_id: int, send_date: Optional[int]=None) -> bool:
2013+
def approve_suggested_post(self, chat_id: int, message_id: int, send_date: Optional[int]=None) -> bool:
20142014
"""
20152015
Use this method to approve a suggested post in a direct messages chat. The bot must have the 'can_post_messages' administrator right in the corresponding channel chat. Returns True on success.
20162016
20172017
Telegram documentation: https://core.telegram.org/bots/api#approvesuggestedpost
20182018
20192019
:param chat_id: Unique identifier for the target direct messages chat
2020-
:type chat_id: :obj:`int` or :obj:`str`
2020+
:type chat_id: :obj:`int`
20212021
20222022
:param message_id: Identifier of a suggested post message to approve
20232023
:type message_id: :obj:`int`
@@ -2032,15 +2032,15 @@ def approve_suggested_post(self, chat_id: Union[int, str], message_id: int, send
20322032
return apihelper.approve_suggested_post(self.token, chat_id, message_id,
20332033
send_date=send_date)
20342034

2035-
def decline_suggested_post(self, chat_id: Union[int, str], message_id: int, comment: Optional[str]=None) -> bool:
2035+
def decline_suggested_post(self, chat_id: int, message_id: int, comment: Optional[str]=None) -> bool:
20362036
"""
20372037
Use this method to decline a suggested post in a direct messages chat. The bot must have
20382038
the 'can_manage_direct_messages' administrator right in the corresponding channel chat. Returns True on success.
20392039
20402040
Telegram documentation: https://core.telegram.org/bots/api#declinesuggestedpost
20412041
20422042
:param chat_id: Unique identifier for the target direct messages chat
2043-
:type chat_id: :obj:`int` or :obj:`str`
2043+
:type chat_id: :obj:`int`
20442044
20452045
:param message_id: Identifier of a suggested post message to decline
20462046
:type message_id: :obj:`int`

telebot/async_telebot.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3537,14 +3537,14 @@ async def copy_message(
35373537
)
35383538
)
35393539

3540-
async def approve_suggested_post(self, chat_id: Union[int, str], message_id: int, send_date: Optional[int]=None) -> bool:
3540+
async def approve_suggested_post(self, chat_id: int, message_id: int, send_date: Optional[int]=None) -> bool:
35413541
"""
35423542
Use this method to approve a suggested post in a direct messages chat. The bot must have the 'can_post_messages' administrator right in the corresponding channel chat. Returns True on success.
35433543
35443544
Telegram documentation: https://core.telegram.org/bots/api#approvesuggestedpost
35453545
35463546
:param chat_id: Unique identifier for the target direct messages chat
3547-
:type chat_id: :obj:`int` or :obj:`str`
3547+
:type chat_id: :obj:`int`
35483548
35493549
:param message_id: Identifier of a suggested post message to approve
35503550
:type message_id: :obj:`int`
@@ -3559,15 +3559,15 @@ async def approve_suggested_post(self, chat_id: Union[int, str], message_id: int
35593559
return await asyncio_helper.approve_suggested_post(self.token, chat_id, message_id,
35603560
send_date=send_date)
35613561

3562-
async def decline_suggested_post(self, chat_id: Union[int, str], message_id: int, comment: Optional[str]=None) -> bool:
3562+
async def decline_suggested_post(self, chat_id: int, message_id: int, comment: Optional[str]=None) -> bool:
35633563
"""
35643564
Use this method to decline a suggested post in a direct messages chat. The bot must have
35653565
the 'can_manage_direct_messages' administrator right in the corresponding channel chat. Returns True on success.
35663566
35673567
Telegram documentation: https://core.telegram.org/bots/api#declinesuggestedpost
35683568
35693569
:param chat_id: Unique identifier for the target direct messages chat
3570-
:type chat_id: :obj:`int` or :obj:`str`
3570+
:type chat_id: :obj:`int`
35713571
35723572
:param message_id: Identifier of a suggested post message to decline
35733573
:type message_id: :obj:`int`

telebot/types.py

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13097,18 +13097,19 @@ class SuggestedPostApproved(JsonDeserializable):
1309713097
:param price: Optional. Amount paid for the post
1309813098
:type price: :class:`SuggestedPostPrice`
1309913099

13100-
:param send_date: Optional. Date when the post will be published
13101-
:type send_date: int
13100+
:param send_date: Date when the post will be published
13101+
:type send_date: :obj:`int`
1310213102

1310313103
:return: Instance of the class
1310413104
:rtype: :class:`SuggestedPostApproved`
1310513105
"""
13106-
def __init__(self, suggested_post_message: Optional[Message] = None,
13106+
def __init__(self, send_date: int,
13107+
suggested_post_message: Optional[Message] = None,
1310713108
price: Optional[SuggestedPostPrice] = None,
13108-
send_date: Optional[int] = None, **kwargs):
13109+
**kwargs):
1310913110
self.suggested_post_message: Optional[Message] = suggested_post_message
1311013111
self.price: Optional[SuggestedPostPrice] = price
13111-
self.send_date: Optional[int] = send_date
13112+
self.send_date: int = send_date
1311213113

1311313114
@classmethod
1311413115
def de_json(cls, json_string):
@@ -13130,18 +13131,24 @@ class SuggestedPostApprovalFailed(JsonDeserializable):
1313013131
:param suggested_post_message: Optional. Message containing the suggested post whose approval has failed. Note that the Message object in this field will not contain the reply_to_message field even if it itself is a reply.
1313113132
:type suggested_post_message: :class:`Message`
1313213133

13134+
:param price: Expected price of the post
13135+
:type price: :class:`SuggestedPostPrice`
13136+
1313313137
:return: Instance of the class
1313413138
:rtype: :class:`SuggestedPostApprovalFailed`
1313513139
"""
13136-
def __init__(self, suggested_post_message: Optional[Message] = None, **kwargs):
13140+
def __init__(self, price: SuggestedPostPrice,
13141+
suggested_post_message: Optional[Message] = None, **kwargs):
1313713142
self.suggested_post_message: Optional[Message] = suggested_post_message
13143+
self.price: SuggestedPostPrice = price
1313813144

1313913145
@classmethod
1314013146
def de_json(cls, json_string):
1314113147
if json_string is None: return None
1314213148
obj = cls.check_json(json_string)
1314313149
if 'suggested_post_message' in obj:
1314413150
obj['suggested_post_message'] = Message.de_json(obj['suggested_post_message'])
13151+
obj['price'] = SuggestedPostPrice.de_json(obj['price'])
1314513152
return cls(**obj)
1314613153

1314713154
class SuggestedPostDeclined(JsonDeserializable):
@@ -13153,6 +13160,9 @@ class SuggestedPostDeclined(JsonDeserializable):
1315313160
:param suggested_post_message: Optional. Message containing the suggested post. Note that the Message object in this field will not contain the reply_to_message field even if it itself is a reply.
1315413161
:type suggested_post_message: :class:`Message`
1315513162

13163+
:param comment: Optional. Comment with which the post was declined
13164+
:type comment: :obj:`str`
13165+
1315613166
:return: Instance of the class
1315713167
:rtype: :class:`SuggestedPostDeclined`
1315813168
"""
@@ -13221,9 +13231,9 @@ class SuggestedPostRefunded(JsonDeserializable):
1322113231
:return: Instance of the class
1322213232
:rtype: :class:`SuggestedPostRefunded`
1322313233
"""
13224-
def __init__(self, suggested_post_message: Optional[Message] = None, reason: Optional[str] = None, **kwargs):
13234+
def __init__(self, reason: str, suggested_post_message: Optional[Message] = None, **kwargs):
1322513235
self.suggested_post_message: Optional[Message] = suggested_post_message
13226-
self.reason: Optional[str] = reason
13236+
self.reason: str = reason
1322713237

1322813238
@classmethod
1322913239
def de_json(cls, json_string):

telebot/util.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@
4141
'chat_background_set', 'forum_topic_created', 'forum_topic_closed', 'forum_topic_reopened', 'forum_topic_edited',
4242
'general_forum_topic_hidden', 'general_forum_topic_unhidden', 'write_access_allowed', 'users_shared', 'chat_shared',
4343
'giveaway_created', 'giveaway_winners', 'giveaway_completed', 'boost_added', 'paid_message_price_changed',
44-
'checklist_tasks_done', 'checklist_tasks_added', 'direct_message_price_changed',
44+
'checklist_tasks_done', 'checklist_tasks_added', 'direct_message_price_changed', 'suggested_post_refunded',
45+
'suggested_post_info', 'suggested_post_approved', 'suggested_post_approval_failed', 'suggested_post_declined',
46+
'suggested_post_paid'
4547
]
4648

4749
#: All update types, should be used for allowed_updates parameter in polling.

0 commit comments

Comments
 (0)