MTPyroger/docs/source/api/handlers.rst

64 lines
1.3 KiB
ReStructuredText
Raw Normal View History

2019-05-10 14:14:10 +00:00
Update Handlers
===============
2018-04-29 17:06:35 +00:00
Handlers are used to instruct Pyrogram about which kind of updates you'd like to handle with your callback functions.
For a much more convenient way of registering callback functions have a look at `Decorators <Decorators.html>`_ instead.
In case you decided to manually create an handler, use :meth:`add_handler() <pyrogram.Client.add_handler>` to register
it.
.. code-block:: python
2019-05-16 19:28:34 +00:00
:emphasize-lines: 1, 10
from pyrogram import Client, MessageHandler
2019-05-16 19:28:34 +00:00
app = Client("my_account")
def dump(client, message):
print(message)
app.add_handler(MessageHandler(dump))
app.run()
.. currentmodule:: pyrogram
.. autosummary::
:nosignatures:
2018-04-29 17:06:35 +00:00
MessageHandler
2018-06-22 10:46:04 +00:00
DeletedMessagesHandler
2018-04-29 17:06:35 +00:00
CallbackQueryHandler
2019-04-12 13:52:06 +00:00
InlineQueryHandler
2018-10-16 10:16:40 +00:00
UserStatusHandler
2019-05-16 19:28:34 +00:00
PollHandler
2018-06-22 10:46:04 +00:00
DisconnectHandler
2018-06-04 09:40:54 +00:00
RawUpdateHandler
.. autoclass:: MessageHandler()
:members:
.. autoclass:: DeletedMessagesHandler()
:members:
.. autoclass:: CallbackQueryHandler()
:members:
.. autoclass:: InlineQueryHandler()
2019-04-12 13:52:06 +00:00
:members:
.. autoclass:: UserStatusHandler()
2018-10-16 10:16:40 +00:00
:members:
2019-05-16 19:28:34 +00:00
.. autoclass:: PollHandler()
:members:
.. autoclass:: DisconnectHandler()
:members:
.. autoclass:: RawUpdateHandler()
:members: