2019-05-10 14:14:10 +00:00
|
|
|
Update Handlers
|
|
|
|
===============
|
2018-04-29 17:06:35 +00:00
|
|
|
|
2019-05-09 02:28:46 +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
|
2019-05-09 02:28:46 +00:00
|
|
|
|
|
|
|
from pyrogram import Client, MessageHandler
|
|
|
|
|
2019-05-16 19:28:34 +00:00
|
|
|
app = Client("my_account")
|
2019-05-09 02:28:46 +00:00
|
|
|
|
|
|
|
|
|
|
|
def dump(client, message):
|
|
|
|
print(message)
|
|
|
|
|
|
|
|
|
|
|
|
app.add_handler(MessageHandler(dump))
|
|
|
|
|
|
|
|
app.run()
|
|
|
|
|
2018-08-11 17:47:49 +00:00
|
|
|
.. 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
|
2018-08-11 17:47:49 +00:00
|
|
|
|
2019-05-09 02:28:46 +00:00
|
|
|
.. autoclass:: MessageHandler()
|
2018-08-11 17:47:49 +00:00
|
|
|
:members:
|
|
|
|
|
2019-05-09 02:28:46 +00:00
|
|
|
.. autoclass:: DeletedMessagesHandler()
|
2018-08-11 17:47:49 +00:00
|
|
|
:members:
|
|
|
|
|
2019-05-09 02:28:46 +00:00
|
|
|
.. autoclass:: CallbackQueryHandler()
|
2018-08-11 17:47:49 +00:00
|
|
|
:members:
|
|
|
|
|
2019-05-09 02:28:46 +00:00
|
|
|
.. autoclass:: InlineQueryHandler()
|
2019-04-12 13:52:06 +00:00
|
|
|
:members:
|
|
|
|
|
2019-05-09 02:28:46 +00:00
|
|
|
.. autoclass:: UserStatusHandler()
|
2018-10-16 10:16:40 +00:00
|
|
|
:members:
|
|
|
|
|
2019-05-16 19:28:34 +00:00
|
|
|
.. autoclass:: PollHandler()
|
|
|
|
:members:
|
|
|
|
|
2019-05-09 02:28:46 +00:00
|
|
|
.. autoclass:: DisconnectHandler()
|
2018-08-11 17:47:49 +00:00
|
|
|
:members:
|
|
|
|
|
2019-05-09 02:28:46 +00:00
|
|
|
.. autoclass:: RawUpdateHandler()
|
2018-08-11 17:47:49 +00:00
|
|
|
:members:
|
|
|
|
|