mirror of
https://github.com/eternnoir/pyTelegramBotAPI.git
synced 2023-08-10 21:12:57 +03:00
added only_if_banned to unban_chat_member
This commit is contained in:
parent
bd27645965
commit
5824d47590
@ -1052,14 +1052,15 @@ class TeleBot:
|
|||||||
"""
|
"""
|
||||||
return apihelper.kick_chat_member(self.token, chat_id, user_id, until_date)
|
return apihelper.kick_chat_member(self.token, chat_id, user_id, until_date)
|
||||||
|
|
||||||
def unban_chat_member(self, chat_id, user_id):
|
def unban_chat_member(self, chat_id, user_id, only_if_banned = False):
|
||||||
"""
|
"""
|
||||||
Removes member from the ban
|
Removes member from the ban
|
||||||
:param chat_id:
|
:param chat_id:
|
||||||
:param user_id:
|
:param user_id:
|
||||||
|
:param only_if_banned:
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
return apihelper.unban_chat_member(self.token, chat_id, user_id)
|
return apihelper.unban_chat_member(self.token, chat_id, user_id, only_if_banned)
|
||||||
|
|
||||||
def restrict_chat_member(
|
def restrict_chat_member(
|
||||||
self, chat_id, user_id, until_date=None,
|
self, chat_id, user_id, until_date=None,
|
||||||
|
@ -700,9 +700,11 @@ def kick_chat_member(token, chat_id, user_id, until_date=None):
|
|||||||
return _make_request(token, method_url, params=payload, method='post')
|
return _make_request(token, method_url, params=payload, method='post')
|
||||||
|
|
||||||
|
|
||||||
def unban_chat_member(token, chat_id, user_id):
|
def unban_chat_member(token, chat_id, user_id, only_if_banned):
|
||||||
method_url = 'unbanChatMember'
|
method_url = 'unbanChatMember'
|
||||||
payload = {'chat_id': chat_id, 'user_id': user_id}
|
payload = {'chat_id': chat_id, 'user_id': user_id}
|
||||||
|
if only_if_banned:
|
||||||
|
payload['only_if_banned'] = only_if_banned
|
||||||
return _make_request(token, method_url, params=payload, method='post')
|
return _make_request(token, method_url, params=payload, method='post')
|
||||||
|
|
||||||
|
|
||||||
|
@ -413,6 +413,7 @@ class Message(JsonDeserializable):
|
|||||||
|
|
||||||
def __init__(self, message_id, from_user, date, chat, content_type, options, json_string):
|
def __init__(self, message_id, from_user, date, chat, content_type, options, json_string):
|
||||||
self.content_type = content_type
|
self.content_type = content_type
|
||||||
|
self.id = message_id # Lets fix the telegram usability ####up with ID in Message :)
|
||||||
self.message_id = message_id
|
self.message_id = message_id
|
||||||
self.from_user = from_user
|
self.from_user = from_user
|
||||||
self.date = date
|
self.date = date
|
||||||
|
Loading…
Reference in New Issue
Block a user