MTPyroger/docs/source/api/handlers.rst

66 lines
1.4 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.
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.
.. code-block:: python
2020-08-22 14:09:38 +00:00
:emphasize-lines: 2, 11
from pyrogram import Client
from pyrogram.handlers import 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()
2020-04-01 18:08:46 +00:00
.. contents:: Contents
:backlinks: none
:depth: 1
2020-04-01 18:08:46 +00:00
:local:
-----
.. currentmodule:: pyrogram.handlers
2019-05-28 14:41:55 +00:00
Index
-----
2019-05-28 14:41:55 +00:00
.. hlist::
:columns: 3
2019-05-28 14:41:55 +00:00
- :class:`MessageHandler`
- :class:`DeletedMessagesHandler`
- :class:`CallbackQueryHandler`
- :class:`InlineQueryHandler`
- :class:`ChosenInlineResultHandler`
- :class:`ChatMemberUpdated`
2019-05-28 14:41:55 +00:00
- :class:`UserStatusHandler`
- :class:`PollHandler`
- :class:`DisconnectHandler`
- :class:`RawUpdateHandler`
-----
Details
-------
.. Handlers
.. autoclass:: MessageHandler()
.. autoclass:: DeletedMessagesHandler()
.. autoclass:: CallbackQueryHandler()
.. autoclass:: InlineQueryHandler()
.. autoclass:: ChosenInlineResultHandler()
.. autoclass:: ChatMemberUpdated()
.. autoclass:: UserStatusHandler()
2019-05-16 19:28:34 +00:00
.. autoclass:: PollHandler()
.. autoclass:: DisconnectHandler()
.. autoclass:: RawUpdateHandler()