mirror of
https://github.com/eternnoir/pyTelegramBotAPI.git
synced 2023-08-10 21:12:57 +03:00
Check and update for full compatibility to Bot API up to 5.3
Pre-release of 4.0.0
This commit is contained in:
@ -1985,7 +1985,7 @@ class TeleBot:
|
||||
timeout: Optional[int]=None,
|
||||
allow_sending_without_reply: Optional[bool]=None,
|
||||
max_tip_amount: Optional[int] = None,
|
||||
suggested_tip_amounts: Optional[list]=None) -> types.Message:
|
||||
suggested_tip_amounts: Optional[List[int]]=None) -> types.Message:
|
||||
"""
|
||||
Sends invoice
|
||||
:param chat_id: Unique identifier for the target private chat
|
||||
|
@ -973,11 +973,11 @@ def create_chat_invite_link(token, chat_id, expire_date, member_limit):
|
||||
}
|
||||
|
||||
if expire_date is not None:
|
||||
payload['expire_date'] = expire_date
|
||||
if isinstance(payload['expire_date'], datetime):
|
||||
payload['expire_date'] = payload['expire_date'].timestamp()
|
||||
|
||||
if member_limit is not None:
|
||||
else:
|
||||
payload['expire_date'] = expire_date
|
||||
if member_limit:
|
||||
payload['member_limit'] = member_limit
|
||||
|
||||
return _make_request(token, method_url, params=payload, method='post')
|
||||
@ -991,9 +991,10 @@ def edit_chat_invite_link(token, chat_id, invite_link, expire_date, member_limit
|
||||
}
|
||||
|
||||
if expire_date is not None:
|
||||
payload['expire_date'] = expire_date
|
||||
if isinstance(payload['expire_date'], datetime):
|
||||
payload['expire_date'] = payload['expire_date'].timestamp()
|
||||
else:
|
||||
payload['expire_date'] = expire_date
|
||||
|
||||
if member_limit is not None:
|
||||
payload['member_limit'] = member_limit
|
||||
@ -1258,7 +1259,7 @@ def get_game_high_scores(token, user_id, chat_id=None, message_id=None, inline_m
|
||||
|
||||
def send_invoice(
|
||||
token, chat_id, title, description, invoice_payload, provider_token, currency, prices,
|
||||
start_parameter, photo_url=None, photo_size=None, photo_width=None, photo_height=None,
|
||||
start_parameter = None, photo_url=None, photo_size=None, photo_width=None, photo_height=None,
|
||||
need_name=None, need_phone_number=None, need_email=None, need_shipping_address=None,
|
||||
send_phone_number_to_provider = None, send_email_to_provider = None, is_flexible=None,
|
||||
disable_notification=None, reply_to_message_id=None, reply_markup=None, provider_data=None,
|
||||
@ -1298,8 +1299,10 @@ def send_invoice(
|
||||
"""
|
||||
method_url = r'sendInvoice'
|
||||
payload = {'chat_id': chat_id, 'title': title, 'description': description, 'payload': invoice_payload,
|
||||
'provider_token': provider_token, 'start_parameter': start_parameter, 'currency': currency,
|
||||
'provider_token': provider_token, 'currency': currency,
|
||||
'prices': _convert_list_json_serializable(prices)}
|
||||
if start_parameter:
|
||||
payload['start_parameter'] = start_parameter
|
||||
if photo_url:
|
||||
payload['photo_url'] = photo_url
|
||||
if photo_size:
|
||||
|
@ -441,12 +441,10 @@ class Message(JsonDeserializable):
|
||||
opts['voice_chat_ended'] = VoiceChatEnded.de_json(obj['voice_chat_ended'])
|
||||
content_type = 'voice_chat_ended'
|
||||
if 'voice_chat_participants_invited' in obj:
|
||||
opts['voice_chat_participants_invited'] = VoiceChatParticipantsInvited.de_json(
|
||||
obj['voice_chat_participants_invited'])
|
||||
opts['voice_chat_participants_invited'] = VoiceChatParticipantsInvited.de_json(obj['voice_chat_participants_invited'])
|
||||
content_type = 'voice_chat_participants_invited'
|
||||
if 'message_auto_delete_timer_changed' in obj:
|
||||
opts['message_auto_delete_timer_changed'] = MessageAutoDeleteTimerChanged.de_json(
|
||||
obj['message_auto_delete_timer_changed'])
|
||||
opts['message_auto_delete_timer_changed'] = MessageAutoDeleteTimerChanged.de_json(obj['message_auto_delete_timer_changed'])
|
||||
content_type = 'message_auto_delete_timer_changed'
|
||||
if 'reply_markup' in obj:
|
||||
opts['reply_markup'] = InlineKeyboardMarkup.de_json(obj['reply_markup'])
|
||||
@ -1232,6 +1230,29 @@ class ChatMember(JsonDeserializable):
|
||||
self.until_date: int = until_date
|
||||
|
||||
|
||||
class ChatMemberOwner(ChatMember):
|
||||
pass
|
||||
|
||||
class ChatMemberAdministrator(ChatMember):
|
||||
pass
|
||||
|
||||
|
||||
class ChatMemberMember(ChatMember):
|
||||
pass
|
||||
|
||||
|
||||
class ChatMemberRestricted(ChatMember):
|
||||
pass
|
||||
|
||||
|
||||
class ChatMemberLeft(ChatMember):
|
||||
pass
|
||||
|
||||
|
||||
class ChatMemberBanned(ChatMember):
|
||||
pass
|
||||
|
||||
|
||||
class ChatPermissions(JsonDeserializable, JsonSerializable, Dictionaryable):
|
||||
@classmethod
|
||||
def de_json(cls, json_string):
|
||||
@ -2744,14 +2765,18 @@ class ChatInviteLink(JsonSerializable, JsonDeserializable, Dictionaryable):
|
||||
return json.dumps(self.to_dict())
|
||||
|
||||
def to_dict(self):
|
||||
return {
|
||||
json_dict = {
|
||||
"invite_link": self.invite_link,
|
||||
"creator": self.creator.to_dict(),
|
||||
"is_primary": self.is_primary,
|
||||
"is_revoked": self.is_revoked,
|
||||
"expire_date": self.expire_date,
|
||||
"member_limit": self.member_limit
|
||||
"is_revoked": self.is_revoked
|
||||
}
|
||||
if self.expire_date:
|
||||
json_dict["expire_date"] = self.expire_date
|
||||
if self.member_limit:
|
||||
json_dict["member_limit"] = self.member_limit
|
||||
return json_dict
|
||||
|
||||
|
||||
class ProximityAlertTriggered(JsonDeserializable):
|
||||
@classmethod
|
||||
@ -2778,6 +2803,7 @@ class VoiceChatStarted(JsonDeserializable):
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
class VoiceChatScheduled(JsonDeserializable):
|
||||
@classmethod
|
||||
def de_json(cls, json_string):
|
||||
|
@ -1,3 +1,3 @@
|
||||
# Versions should comply with PEP440.
|
||||
# This line is parsed in setup.py:
|
||||
__version__ = '3.8.2'
|
||||
__version__ = '3.8.3'
|
||||
|
Reference in New Issue
Block a user