From 7596f2b797dab2307f6c6d7193be6485278adf61 Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Sat, 21 Oct 2017 13:47:54 +0200 Subject: [PATCH] Fix and enhance "no workers set" warning --- telethon/telegram_bare_client.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/telethon/telegram_bare_client.py b/telethon/telegram_bare_client.py index 53edb008..6e7029c8 100644 --- a/telethon/telegram_bare_client.py +++ b/telethon/telegram_bare_client.py @@ -756,8 +756,12 @@ class TelegramBareClient: def add_update_handler(self, handler): """Adds an update handler (a function which takes a TLObject, an update, as its parameter) and listens for updates""" - if not self.updates.get_workers: - warnings.warn("There are no update workers running, so adding an update handler will have no effect.") + if self.updates.workers is None: + warnings.warn( + "You have not setup any workers, so you won't receive updates." + " Pass update_workers=4 when creating the TelegramClient," + " or set client.self.updates.workers = 4" + ) self.updates.handlers.append(handler)