mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-11 01:54:53 +00:00
Allow to cancel event from the Middleware.on_pre_process_<event type>
This commit is contained in:
parent
163ca0d53a
commit
856b9e864f
1 changed files with 5 additions and 1 deletions
|
|
@ -60,7 +60,11 @@ class Handler:
|
|||
results = []
|
||||
|
||||
if self.middleware_key:
|
||||
await self.dispatcher.middleware.trigger(f"pre_process_{self.middleware_key}", args)
|
||||
try:
|
||||
await self.dispatcher.middleware.trigger(f"pre_process_{self.middleware_key}", args)
|
||||
except CancelHandler: # Allow to cancel current event
|
||||
return results
|
||||
|
||||
for filters, handler in self.handlers:
|
||||
if await check_filters(filters, args):
|
||||
try:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue