1
0
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:
Badiboy 2020-11-18 02:22:52 +03:00
parent bd27645965
commit 5824d47590
3 changed files with 7 additions and 3 deletions

View File

@ -1052,14 +1052,15 @@ class TeleBot:
"""
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
:param chat_id:
:param user_id:
:param only_if_banned:
: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(
self, chat_id, user_id, until_date=None,

View File

@ -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')
def unban_chat_member(token, chat_id, user_id):
def unban_chat_member(token, chat_id, user_id, only_if_banned):
method_url = 'unbanChatMember'
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')

View File

@ -413,6 +413,7 @@ class Message(JsonDeserializable):
def __init__(self, message_id, from_user, date, chat, content_type, options, json_string):
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.from_user = from_user
self.date = date