Skip to content

Commit

Permalink
Merge pull request #1500 from coder2020official/master
Browse files Browse the repository at this point in the history
Road to release(1st part)
  • Loading branch information
Badiboy authored Apr 15, 2022
2 parents 1688a46 + 22b4e63 commit 110575c
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
3 changes: 3 additions & 0 deletions telebot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3849,6 +3849,9 @@ def _run_middlewares_and_handler(self, message, handlers, middlewares, *args, **
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)
Expand Down
2 changes: 1 addition & 1 deletion telebot/asyncio_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ async def check(self, message, text):
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


Expand Down
1 change: 1 addition & 0 deletions telebot/asyncio_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion telebot/custom_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ def check(self, message, text):
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


Expand Down

0 comments on commit 110575c

Please sign in to comment.