2018-04-28 14:37:19 +03:00
|
|
|
from .raw import Raw
|
2018-04-05 21:14:22 +03:00
|
|
|
from .chataction import ChatAction
|
|
|
|
from .messagedeleted import MessageDeleted
|
|
|
|
from .messageedited import MessageEdited
|
|
|
|
from .messageread import MessageRead
|
|
|
|
from .newmessage import NewMessage
|
|
|
|
from .userupdate import UserUpdate
|
2018-07-10 17:03:30 +03:00
|
|
|
from .callbackquery import CallbackQuery
|
2018-07-15 12:31:14 +03:00
|
|
|
from .inlinequery import InlineQuery
|
2018-03-28 16:52:35 +03:00
|
|
|
|
|
|
|
|
2018-02-27 13:30:42 +03:00
|
|
|
class StopPropagation(Exception):
|
|
|
|
"""
|
2018-03-21 10:55:13 +03:00
|
|
|
If this exception is raised in any of the handlers for a given event,
|
|
|
|
it will stop the execution of all other registered event handlers.
|
|
|
|
It can be seen as the ``StopIteration`` in a for loop but for events.
|
2018-02-27 13:30:42 +03:00
|
|
|
|
|
|
|
Example usage:
|
2018-04-05 21:14:22 +03:00
|
|
|
>>> from telethon import TelegramClient, events
|
|
|
|
>>> client = TelegramClient(...)
|
|
|
|
>>>
|
2018-03-21 10:55:13 +03:00
|
|
|
>>> @client.on(events.NewMessage)
|
2018-07-08 16:11:10 +03:00
|
|
|
... async def delete(event):
|
|
|
|
... await event.delete()
|
2018-03-21 10:55:13 +03:00
|
|
|
... # No other event handler will have a chance to handle this event
|
|
|
|
... raise StopPropagation
|
|
|
|
...
|
|
|
|
>>> @client.on(events.NewMessage)
|
2018-07-08 16:11:10 +03:00
|
|
|
... async def _(event):
|
2018-03-21 10:55:13 +03:00
|
|
|
... # Will never be reached, because it is the second handler
|
|
|
|
... pass
|
2018-02-27 13:30:42 +03:00
|
|
|
"""
|
2018-03-21 10:55:13 +03:00
|
|
|
# For some reason Sphinx wants the silly >>> or
|
|
|
|
# it will show warnings and look bad when generated.
|
|
|
|
pass
|