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

Add missing arg until_date for kickChatMember.

This commit is contained in:
eternnoir 2017-07-01 11:11:25 +08:00
parent 514880fe22
commit 5f8ed347a1
2 changed files with 7 additions and 3 deletions

View File

@ -620,14 +620,16 @@ class TeleBot:
"""
return apihelper.send_chat_action(self.token, chat_id, action)
def kick_chat_member(self, chat_id, user_id):
def kick_chat_member(self, chat_id, user_id, until_date=None):
"""
Use this method to kick a user from a group or a supergroup.
:param chat_id: Int or string : Unique identifier for the target group or username of the target supergroup
:param user_id: Int : Unique identifier of the target user
:param until_date: Date when the user will be unbanned, unix time. If user is banned for more than 366 days or
less than 30 seconds from the current time they are considered to be banned forever
:return: types.Message
"""
return apihelper.kick_chat_member(self.token, chat_id, user_id)
return apihelper.kick_chat_member(self.token, chat_id, user_id, until_date)
def unban_chat_member(self, chat_id, user_id):
return apihelper.unban_chat_member(self.token, chat_id, user_id)

View File

@ -420,9 +420,11 @@ def get_method_by_type(data_type):
return r'sendSticker'
def kick_chat_member(token, chat_id, user_id):
def kick_chat_member(token, chat_id, user_id, until_date=None):
method_url = 'kickChatMember'
payload = {'chat_id': chat_id, 'user_id': user_id}
if until_date:
payload['until_date'] = until_date
return _make_request(token, method_url, params=payload, method='post')