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.
|
2019-05-28 14:41:55 +00:00
|
|
|
For a much more convenient way of registering callback functions have a look at :doc:`Decorators <decorators>` instead.
|
2019-05-09 02:28:46 +00:00
|
|
|
|
|
|
|
.. code-block:: python
|
|
|
|
|
2020-08-22 06:05:05 +00:00
|
|
|
from pyrogram import Client
|
|
|
|
from pyrogram.handlers import MessageHandler
|
2019-05-09 02:28:46 +00:00
|
|
|
|
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()
|
|
|
|
|
2020-04-01 18:08:46 +00:00
|
|
|
.. contents:: Contents
|
|
|
|
:backlinks: none
|
2020-08-22 06:05:05 +00:00
|
|
|
:depth: 1
|
2020-04-01 18:08:46 +00:00
|
|
|
:local:
|
|
|
|
|
|
|
|
-----
|
|
|
|
|
2020-08-22 06:05:05 +00:00
|
|
|
.. currentmodule:: pyrogram.handlers
|
2018-08-11 17:47:49 +00:00
|
|
|
|
2019-05-28 14:41:55 +00:00
|
|
|
Index
|
|
|
|
-----
|
2018-08-11 17:47:49 +00:00
|
|
|
|
2019-05-28 14:41:55 +00:00
|
|
|
.. hlist::
|
|
|
|
:columns: 3
|
2018-08-11 17:47:49 +00:00
|
|
|
|
2019-05-28 14:41:55 +00:00
|
|
|
- :class:`MessageHandler`
|
2022-04-24 09:56:07 +00:00
|
|
|
- :class:`EditedMessageHandler`
|
2019-05-28 14:41:55 +00:00
|
|
|
- :class:`DeletedMessagesHandler`
|
|
|
|
- :class:`CallbackQueryHandler`
|
|
|
|
- :class:`InlineQueryHandler`
|
2020-04-03 15:15:28 +00:00
|
|
|
- :class:`ChosenInlineResultHandler`
|
2021-03-17 14:42:54 +00:00
|
|
|
- :class:`ChatMemberUpdatedHandler`
|
2019-05-28 14:41:55 +00:00
|
|
|
- :class:`UserStatusHandler`
|
|
|
|
- :class:`PollHandler`
|
|
|
|
- :class:`DisconnectHandler`
|
|
|
|
- :class:`RawUpdateHandler`
|
|
|
|
|
|
|
|
-----
|
|
|
|
|
|
|
|
Details
|
|
|
|
-------
|
|
|
|
|
|
|
|
.. Handlers
|
2019-05-09 02:28:46 +00:00
|
|
|
.. autoclass:: MessageHandler()
|
2022-04-24 09:56:07 +00:00
|
|
|
.. autoclass:: EditedMessageHandler()
|
2019-05-09 02:28:46 +00:00
|
|
|
.. autoclass:: DeletedMessagesHandler()
|
|
|
|
.. autoclass:: CallbackQueryHandler()
|
|
|
|
.. autoclass:: InlineQueryHandler()
|
2020-04-03 15:15:28 +00:00
|
|
|
.. autoclass:: ChosenInlineResultHandler()
|
2021-03-17 14:42:54 +00:00
|
|
|
.. autoclass:: ChatMemberUpdatedHandler()
|
2019-05-09 02:28:46 +00:00
|
|
|
.. autoclass:: UserStatusHandler()
|
2019-05-16 19:28:34 +00:00
|
|
|
.. autoclass:: PollHandler()
|
2019-05-09 02:28:46 +00:00
|
|
|
.. autoclass:: DisconnectHandler()
|
|
|
|
.. autoclass:: RawUpdateHandler()
|