From 22b4e636e2e3ee6669f77d38af7d9b912d564fd7 Mon Sep 17 00:00:00 2001 From: coder2020official Date: Sat, 16 Apr 2022 00:13:14 +0500 Subject: [PATCH] Road to release(1st part) --- telebot/__init__.py | 3 +++ telebot/asyncio_filters.py | 2 +- telebot/asyncio_helper.py | 1 + telebot/custom_filters.py | 2 +- 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/telebot/__init__.py b/telebot/__init__.py index 2a1bce9..55d322e 100644 --- a/telebot/__init__.py +++ b/telebot/__init__.py @@ -3849,6 +3849,9 @@ class TeleBot: elif len(params) == 3: if params[2] == 'bot' and handler.get('pass_bot') is True: handler['function'](message, data, self) + + elif not handler.get('pass_bot'): + raise RuntimeError('Your handler accepts 3 parameters but pass_bot is False. Please re-check your handler.') else: handler['function'](message, self, data) diff --git a/telebot/asyncio_filters.py b/telebot/asyncio_filters.py index 1b39761..98874b9 100644 --- a/telebot/asyncio_filters.py +++ b/telebot/asyncio_filters.py @@ -303,7 +303,7 @@ class StateFilter(AdvancedCustomFilter): group_state = await self.bot.current_states.get_state(user_id, chat_id) if group_state == text: return True - elif group_state in text and type(text) is list: + elif type(text) is list and group_state in text: return True diff --git a/telebot/asyncio_helper.py b/telebot/asyncio_helper.py index e8a9867..aaac114 100644 --- a/telebot/asyncio_helper.py +++ b/telebot/asyncio_helper.py @@ -67,6 +67,7 @@ async def _process_request(token, url, method='get', params=None, files=None, re logger.debug("Request: method={0} url={1} params={2} files={3} request_timeout={4} current_try={5}".format(method, url, params, files, request_timeout, current_try).replace(token, token.split(':')[0] + ":{TOKEN}")) json_result = await _check_result(url, resp) if json_result: + got_result = True return json_result['result'] except (ApiTelegramException,ApiInvalidJSONException, ApiHTTPException) as e: raise e diff --git a/telebot/custom_filters.py b/telebot/custom_filters.py index 8442be4..1bd80b3 100644 --- a/telebot/custom_filters.py +++ b/telebot/custom_filters.py @@ -311,7 +311,7 @@ class StateFilter(AdvancedCustomFilter): group_state = self.bot.current_states.get_state(user_id, chat_id) if group_state == text: return True - elif group_state in text and type(text) is list: + elif type(text) is list and group_state in text: return True