From 13e59983af49e2ec7dca23ee333b3d81b1b4fb00 Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Sat, 24 Mar 2018 12:41:42 +0100 Subject: [PATCH] Slightly change docs for events (#668) --- readthedocs/extra/basic/getting-started.rst | 20 ++++++++++++++++++++ telethon/events/__init__.py | 6 ++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/readthedocs/extra/basic/getting-started.rst b/readthedocs/extra/basic/getting-started.rst index 87c142e9..e40bae44 100644 --- a/readthedocs/extra/basic/getting-started.rst +++ b/readthedocs/extra/basic/getting-started.rst @@ -66,6 +66,26 @@ Basic Usage **More details**: :ref:`telegram-client` +Handling Updates +**************** + + .. code-block:: python + + from telethon import events + + # We need to have some worker running + client.updates.workers = 1 + + @client.on(events.NewMessage(incoming=True, pattern='(?i)hi')) + def handler(event): + event.reply('Hello!') + + # If you want to handle updates you can't let the script end. + input('Press enter to exit.') + + **More details**: :ref:`working-with-updates` + + ---------- You can continue by clicking on the "More details" link below each diff --git a/telethon/events/__init__.py b/telethon/events/__init__.py index a3c4774e..8b80bfd8 100644 --- a/telethon/events/__init__.py +++ b/telethon/events/__init__.py @@ -37,8 +37,10 @@ class _EventBuilder(abc.ABC): only matching chats will be handled. blacklist_chats (:obj:`bool`, optional): - Whether to treat the the list of chats as a blacklist (if - it matches it will NOT be handled) or a whitelist (default). + Whether to treat the chats as a blacklist instead of + as a whitelist (default). This means that every chat + will be handled *except* those specified in ``chats`` + which will be ignored if ``blacklist_chats=True``. """ def __init__(self, chats=None, blacklist_chats=False): self.chats = chats