forked from uniborg/uniborg
make await_event stop propagation only if the filter raises
This commit is contained in:
parent
32e9a20f39
commit
98bdf910e4
|
@ -87,9 +87,12 @@ class Uniborg(TelegramClient):
|
|||
|
||||
@self.on(event_matcher)
|
||||
async def cb(event):
|
||||
if filter is None or await filter(event):
|
||||
try:
|
||||
if filter is None or await filter(event):
|
||||
fut.set_result(event)
|
||||
except telethon.events.StopPropagation:
|
||||
fut.set_result(event)
|
||||
raise telethon.events.StopPropagation
|
||||
raise
|
||||
|
||||
fut.add_done_callback(
|
||||
lambda _: self.remove_event_handler(cb, event_matcher))
|
||||
|
|
Loading…
Reference in New Issue