forked from kate/uniborg
Stop propagation of awaited events
This commit is contained in:
parent
4c7923dd44
commit
881266f96e
|
@ -9,6 +9,7 @@ from pathlib import Path
|
||||||
|
|
||||||
from telethon import TelegramClient
|
from telethon import TelegramClient
|
||||||
import telethon.utils
|
import telethon.utils
|
||||||
|
import telethon.events
|
||||||
|
|
||||||
from . import hacks
|
from . import hacks
|
||||||
|
|
||||||
|
@ -84,6 +85,7 @@ class Uniborg(TelegramClient):
|
||||||
async def cb(event):
|
async def cb(event):
|
||||||
if filter is None or await filter(event):
|
if filter is None or await filter(event):
|
||||||
fut.set_result(event)
|
fut.set_result(event)
|
||||||
|
raise telethon.events.StopPropagation
|
||||||
|
|
||||||
fut.add_done_callback(lambda _:
|
fut.add_done_callback(lambda _:
|
||||||
self.remove_event_handler(cb, event_matcher))
|
self.remove_event_handler(cb, event_matcher))
|
||||||
|
|
Loading…
Reference in New Issue