mirror of
https://github.com/eternnoir/pyTelegramBotAPI.git
synced 2023-08-10 21:12:57 +03:00
improve code quality
This commit is contained in:
parent
30aaf8d0f1
commit
4798c26188
@ -6080,11 +6080,13 @@ class TeleBot:
|
|||||||
for handler in handlers:
|
for handler in handlers:
|
||||||
if self._test_message_handler(handler, message):
|
if self._test_message_handler(handler, message):
|
||||||
if handler.get('pass_bot', False):
|
if handler.get('pass_bot', False):
|
||||||
handler['function'](message, bot = self)
|
result = handler['function'](message, bot=self)
|
||||||
else:
|
else:
|
||||||
handler['function'](message)
|
result = handler['function'](message)
|
||||||
|
if not isinstance(result, ContinueHandling):
|
||||||
break
|
break
|
||||||
else:
|
return
|
||||||
|
|
||||||
data = {}
|
data = {}
|
||||||
params =[]
|
params =[]
|
||||||
handler_error = None
|
handler_error = None
|
||||||
@ -6107,7 +6109,7 @@ class TeleBot:
|
|||||||
elif isinstance(result, SkipHandler):
|
elif isinstance(result, SkipHandler):
|
||||||
skip_handlers = True
|
skip_handlers = True
|
||||||
|
|
||||||
if handlers and not(skip_handlers):
|
if handlers and not skip_handlers:
|
||||||
try:
|
try:
|
||||||
for handler in handlers:
|
for handler in handlers:
|
||||||
process_handler = self._test_message_handler(handler, message)
|
process_handler = self._test_message_handler(handler, message)
|
||||||
|
@ -249,6 +249,8 @@ class SkipHandler:
|
|||||||
Update will go to post_process,
|
Update will go to post_process,
|
||||||
but will skip execution of handler.
|
but will skip execution of handler.
|
||||||
"""
|
"""
|
||||||
|
def __init__(self) -> None:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class CancelUpdate:
|
class CancelUpdate:
|
||||||
@ -259,6 +261,9 @@ class CancelUpdate:
|
|||||||
Update will skip handler and execution
|
Update will skip handler and execution
|
||||||
of post_process in middlewares.
|
of post_process in middlewares.
|
||||||
"""
|
"""
|
||||||
|
def __init__(self) -> None:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class ContinueHandling:
|
class ContinueHandling:
|
||||||
"""
|
"""
|
||||||
@ -266,3 +271,6 @@ class ContinueHandling:
|
|||||||
Just return instance of this class
|
Just return instance of this class
|
||||||
in handlers to continue process.
|
in handlers to continue process.
|
||||||
"""
|
"""
|
||||||
|
def __init__(self) -> None:
|
||||||
|
pass
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user