1
0
mirror of https://github.com/eternnoir/pyTelegramBotAPI.git synced 2023-08-10 21:12:57 +03:00

Update readme and typo

This commit is contained in:
Badiboy 2021-11-08 18:51:42 +03:00
parent d14ac2fe85
commit 9b99bb5f21
4 changed files with 22 additions and 14 deletions

View File

@ -683,6 +683,7 @@ Result will be:
## API conformance
* ✔ [Bot API 5.4](https://core.telegram.org/bots/api#november-5-2021)
* [Bot API 5.3](https://core.telegram.org/bots/api#june-25-2021) - ChatMemberXXX classes are full copies of ChatMember
* ✔ [Bot API 5.2](https://core.telegram.org/bots/api#april-26-2021)
* ✔ [Bot API 5.1](https://core.telegram.org/bots/api#march-9-2021)

View File

@ -245,7 +245,6 @@ class TeleBot:
Enable saving states (by default saving disabled)
:param filename: Filename of saving file
"""
self.current_states = StateFile(filename=filename)
@ -1690,8 +1689,10 @@ class TeleBot:
:param chat_id: Id: Unique identifier for the target chat or username of the target channel
(in the format @channelusername)
:param name: Invite link name; 0-32 characters
:param expire_date: Point in time (Unix timestamp) when the link will expire
:param member_limit: Maximum number of users that can be members of the chat simultaneously
:param creates_join_request: True, if users joining the chat via the link need to be approved by chat administrators. If True, member_limit can't be specified
:return:
"""
return types.ChatInviteLink.de_json(
@ -1699,21 +1700,23 @@ class TeleBot:
)
def edit_chat_invite_link(
self, chat_id: Union[int, str], name: Optional[str]=None,
invite_link: Optional[str] = None,
expire_date: Optional[Union[int, datetime]]=None,
member_limit: Optional[int]=None ,
self, chat_id: Union[int, str],
invite_link: Optional[str] = None,
name: Optional[str]=None,
expire_date: Optional[Union[int, datetime]]=None,
member_limit: Optional[int]=None,
creates_join_request: Optional[bool]=None) -> types.ChatInviteLink:
"""
Use this method to edit a non-primary invite link created by the bot.
The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
:param invite_link:
:param chat_id: Id: Unique identifier for the target chat or username of the target channel
(in the format @channelusername)
:param name: Invite link name; 0-32 characters
:param invite_link: The invite link to edit
:param expire_date: Point in time (Unix timestamp) when the link will expire
:param member_limit: Maximum number of users that can be members of the chat simultaneously
:param creates_join_request: True, if users joining the chat via the link need to be approved by chat administrators. If True, member_limit can't be specified
:return:
"""
return types.ChatInviteLink.de_json(

View File

@ -1016,7 +1016,7 @@ def edit_chat_invite_link(token, chat_id, invite_link, name, expire_date, member
payload['member_limit'] = member_limit
if name:
payload['name'] = name
if creates_join_request:
if creates_join_request is not None:
payload['creates_join_request'] = creates_join_request
return _make_request(token, method_url, params=payload, method='post')
@ -1036,6 +1036,7 @@ def export_chat_invite_link(token, chat_id):
payload = {'chat_id': chat_id}
return _make_request(token, method_url, params=payload, method='post')
def approve_chat_join_request(token, chat_id, user_id):
method_url = 'approveChatJoinRequest'
payload = {
@ -1043,6 +1044,8 @@ def approve_chat_join_request(token, chat_id, user_id):
'user_id': user_id
}
return _make_request(token, method_url, params=payload, method='post')
def decline_chat_join_request(token, chat_id, user_id):
method_url = 'declineChatJoinRequest'
payload = {
@ -1050,6 +1053,8 @@ def decline_chat_join_request(token, chat_id, user_id):
'user_id': user_id
}
return _make_request(token, method_url, params=payload, method='post')
def set_chat_photo(token, chat_id, photo):
method_url = 'setChatPhoto'
payload = {'chat_id': chat_id}

View File

@ -175,16 +175,15 @@ class ChatJoinRequest(JsonDeserializable):
obj = cls.check_json(json_string)
obj['chat'] = Chat.de_json(obj['chat'])
obj['from_user'] = User.de_json(obj['from'])
obj['invite_link'] = ChatInviteLink.de_json(obj['invite_link'])
obj['invite_link'] = ChatInviteLink.de_json(obj.get('invite_link'))
return cls(**obj)
def __init__(self, chat, from_user, date, bio=None, invite_link=None, **kwargs):
self.chat = Chat = chat
self.from_user: User = from_user
self.date: int = date
self.bio: Optional[str] = bio
self.invite_link: Optional[ChatInviteLink] = invite_link
self.chat = chat
self.from_user = from_user
self.date = date
self.bio = bio
self.invite_link = invite_link
class WebhookInfo(JsonDeserializable):
@classmethod