mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-06 16:15:51 +00:00
Add current handler to filters, so that flags can be retrieved from it. (#1360)
* Add current handler to filters, so that flags can be retrieved from it. * run black isort * add changelog * Update CHANGES/1360.bugfix.rst Co-authored-by: Alex Root Junior <jroot.junior@gmail.com> --------- Co-authored-by: Alex Root Junior <jroot.junior@gmail.com>
This commit is contained in:
parent
228a86afdc
commit
9b5e462068
3 changed files with 4 additions and 2 deletions
1
CHANGES/1360.bugfix.rst
Normal file
1
CHANGES/1360.bugfix.rst
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
Added current handler to filters, so that flags can be retrieved from it.
|
||||||
|
|
@ -109,9 +109,10 @@ class TelegramEventObserver:
|
||||||
Handler will be called when all its filters are pass.
|
Handler will be called when all its filters are pass.
|
||||||
"""
|
"""
|
||||||
for handler in self.handlers:
|
for handler in self.handlers:
|
||||||
|
kwargs["handler"] = handler
|
||||||
result, data = await handler.check(event, **kwargs)
|
result, data = await handler.check(event, **kwargs)
|
||||||
if result:
|
if result:
|
||||||
kwargs.update(data, handler=handler)
|
kwargs.update(data)
|
||||||
try:
|
try:
|
||||||
wrapped_inner = self.outer_middleware.wrap_middlewares(
|
wrapped_inner = self.outer_middleware.wrap_middlewares(
|
||||||
self._resolve_middlewares(),
|
self._resolve_middlewares(),
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@ from aiogram.methods import (
|
||||||
UnpinChatMessage,
|
UnpinChatMessage,
|
||||||
)
|
)
|
||||||
from aiogram.types import (
|
from aiogram.types import (
|
||||||
|
UNSET_PARSE_MODE,
|
||||||
Animation,
|
Animation,
|
||||||
Audio,
|
Audio,
|
||||||
Chat,
|
Chat,
|
||||||
|
|
@ -75,7 +76,6 @@ from aiogram.types import (
|
||||||
VideoNote,
|
VideoNote,
|
||||||
Voice,
|
Voice,
|
||||||
WebAppData,
|
WebAppData,
|
||||||
UNSET_PARSE_MODE,
|
|
||||||
)
|
)
|
||||||
from aiogram.types.message import ContentType, Message
|
from aiogram.types.message import ContentType, Message
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue