From 5f8ed347a1a284e0d063787864d1265b986fde9e Mon Sep 17 00:00:00 2001 From: eternnoir Date: Sat, 1 Jul 2017 11:11:25 +0800 Subject: [PATCH] Add missing arg until_date for kickChatMember. --- telebot/__init__.py | 6 ++++-- telebot/apihelper.py | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/telebot/__init__.py b/telebot/__init__.py index 7486b51..0b41938 100644 --- a/telebot/__init__.py +++ b/telebot/__init__.py @@ -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) diff --git a/telebot/apihelper.py b/telebot/apihelper.py index 3268930..9c1b785 100644 --- a/telebot/apihelper.py +++ b/telebot/apihelper.py @@ -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')