Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix filtering skip_patterns #868

Merged
merged 2 commits into from Aug 13, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 7 additions & 2 deletions aiogram/dispatcher/middlewares.py
Expand Up @@ -118,8 +118,13 @@ async def post_process(self, obj, data, *args):
pass

async def trigger(self, action, args):
if self.skip_patterns is not None and any(item in action for item in self.skip_patterns):
return False
if self.skip_patterns:
skip_actions = (
Tishka17 marked this conversation as resolved.
Show resolved Hide resolved
(f"pre_process_{item}", f"process_{item}", f"post_process_{item}")
for item in self.skip_patterns
)
if any(action in item_actions for item_actions in skip_actions):
return False

obj, *args, data = args
if action.startswith('pre_process_'):
Expand Down