From 881266f96eb544e420c12e403face46bbbf3b716 Mon Sep 17 00:00:00 2001 From: Dan Elkouby Date: Sun, 8 Apr 2018 16:09:57 +0300 Subject: [PATCH] Stop propagation of awaited events --- uniborg/telethon.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/uniborg/telethon.py b/uniborg/telethon.py index 672cbfb..1d8c488 100644 --- a/uniborg/telethon.py +++ b/uniborg/telethon.py @@ -9,6 +9,7 @@ from pathlib import Path from telethon import TelegramClient import telethon.utils +import telethon.events from . import hacks @@ -84,6 +85,7 @@ class Uniborg(TelegramClient): async def cb(event): if filter is None or await filter(event): fut.set_result(event) + raise telethon.events.StopPropagation fut.add_done_callback(lambda _: self.remove_event_handler(cb, event_matcher))