Skip to content

Commit

Permalink
Add missing arg until_date for kickChatMember.
Browse files Browse the repository at this point in the history
  • Loading branch information
eternnoir committed Jul 1, 2017
1 parent 514880f commit 5f8ed34
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 4 additions & 2 deletions telebot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -620,14 +620,16 @@ def send_chat_action(self, chat_id, action):
"""
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)
Expand Down
4 changes: 3 additions & 1 deletion telebot/apihelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')


Expand Down

0 comments on commit 5f8ed34

Please sign in to comment.