diff --git a/telebot/__init__.py b/telebot/__init__.py index 7adeeb1..3c14456 100644 --- a/telebot/__init__.py +++ b/telebot/__init__.py @@ -103,7 +103,6 @@ class TeleBot: editMessageReplyMarkup editMessageLiveLocation stopMessageLiveLocation - kickChatMember banChatMember unbanChatMember restrictChatMember @@ -132,7 +131,6 @@ class TeleBot: leaveChat getChat getChatAdministrators - getChatMembersCount getChatMemberCount getChatMember answerCallbackQuery @@ -845,7 +843,8 @@ class TeleBot: :param chat_id: :return: """ - result = apihelper.get_chat_members_count(self.token, chat_id) + logger.info('get_chat_members_count is deprecated. Use get_chat_member_count instead.') + result = apihelper.get_chat_member_count(self.token, chat_id) return result def get_chat_member_count(self, chat_id: Union[int, str]) -> int: @@ -1485,7 +1484,8 @@ class TeleBot: Always True for supergroups and channels. :return: boolean """ - return apihelper.kick_chat_member(self.token, chat_id, user_id, until_date, revoke_messages) + logger.info('kick_chat_member is deprecated. Use ban_chat_member instead.') + return apihelper.ban_chat_member(self.token, chat_id, user_id, until_date, revoke_messages) def ban_chat_member( self, chat_id: Union[int, str], user_id: int, @@ -2971,7 +2971,8 @@ class AsyncTeleBot(TeleBot): @util.async_dec() def get_chat_members_count(self, *args): - return TeleBot.get_chat_members_count(self, *args) + logger.info('get_chat_members_count is deprecated. Use get_chat_member_count instead') + return TeleBot.get_chat_member_count(self, *args) @util.async_dec() def get_chat_member_count(self, *args): @@ -3071,7 +3072,8 @@ class AsyncTeleBot(TeleBot): @util.async_dec() def kick_chat_member(self, *args, **kwargs): - return TeleBot.kick_chat_member(self, *args, **kwargs) + logger.info('kick_chat_member is deprecated. Use ban_chat_member instead.') + return TeleBot.ban_chat_member(self, *args, **kwargs) @util.async_dec() def ban_chat_member(self, *args, **kwargs): diff --git a/telebot/apihelper.py b/telebot/apihelper.py index 7b1779a..ca8ec8c 100644 --- a/telebot/apihelper.py +++ b/telebot/apihelper.py @@ -330,12 +330,6 @@ def get_chat_administrators(token, chat_id): return _make_request(token, method_url, params=payload) -def get_chat_members_count(token, chat_id): - method_url = r'getChatMembersCount' - payload = {'chat_id': chat_id} - return _make_request(token, method_url, params=payload) - - def get_chat_member_count(token, chat_id): method_url = r'getChatMemberCount' payload = {'chat_id': chat_id} @@ -856,18 +850,6 @@ def get_method_by_type(data_type): return r'sendSticker' -def kick_chat_member(token, chat_id, user_id, until_date=None, revoke_messages=None): - method_url = 'kickChatMember' - payload = {'chat_id': chat_id, 'user_id': user_id} - if isinstance(until_date, datetime): - payload['until_date'] = until_date.timestamp() - else: - payload['until_date'] = until_date - if revoke_messages is not None: - payload['revoke_messages'] = revoke_messages - return _make_request(token, method_url, params=payload, method='post') - - def ban_chat_member(token, chat_id, user_id, until_date=None, revoke_messages=None): method_url = 'banChatMember' payload = {'chat_id': chat_id, 'user_id': user_id}