mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-13 04:56:35 +03:00
Slightly change docs for events (#668)
This commit is contained in:
parent
69d283a296
commit
13e59983af
|
@ -66,6 +66,26 @@ Basic Usage
|
||||||
**More details**: :ref:`telegram-client`
|
**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
|
You can continue by clicking on the "More details" link below each
|
||||||
|
|
|
@ -37,8 +37,10 @@ class _EventBuilder(abc.ABC):
|
||||||
only matching chats will be handled.
|
only matching chats will be handled.
|
||||||
|
|
||||||
blacklist_chats (:obj:`bool`, optional):
|
blacklist_chats (:obj:`bool`, optional):
|
||||||
Whether to treat the the list of chats as a blacklist (if
|
Whether to treat the chats as a blacklist instead of
|
||||||
it matches it will NOT be handled) or a whitelist (default).
|
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):
|
def __init__(self, chats=None, blacklist_chats=False):
|
||||||
self.chats = chats
|
self.chats = chats
|
||||||
|
|
Loading…
Reference in New Issue
Block a user