Decorators¶
Decorators are able to register callback functions for handling updates in a much easier and cleaner way compared to
Handlers; they do so by instantiating the correct handler and calling
add_handler() automatically. All you need to do is adding the decorators on top of your
functions.
from pyrogram import Client
app = Client("my_account")
@app.on_message()
def log(client, message):
print(message)
app.run()
Contents
Index¶
|
Details¶
- @pyrogram.Client.on_bot_business_connect¶
Decorator for handling bot business connection.
This does the same thing as
add_handler()using theBotBusinessConnectHandler.
- @pyrogram.Client.on_message¶
Decorator for handling new messages.
This does the same thing as
add_handler()using theMessageHandler.Usable by Users Bots
- @pyrogram.Client.on_bot_business_message¶
Decorator for handling new bot business messages.
This does the same thing as
add_handler()using theBotBusinessMessageHandler.
- @pyrogram.Client.on_edited_message¶
Decorator for handling edited messages.
This does the same thing as
add_handler()using theEditedMessageHandler.Usable by Users Bots
- @pyrogram.Client.on_edited_bot_business_message¶
Decorator for handling edited messages.
This does the same thing as
add_handler()using theEditedBotBusinessMessageHandler.
- @pyrogram.Client.on_callback_query¶
Decorator for handling callback queries.
This does the same thing as
add_handler()using theCallbackQueryHandler.Usable by Users Bots
- @pyrogram.Client.on_message_reaction_updated¶
Decorator for handling reaction changes on messages.
This does the same thing as
add_handler()using theMessageReactionUpdatedHandler.Usable by Users Bots
- @pyrogram.Client.on_message_reaction_count_updated¶
Decorator for handling anonymous reaction changes on messages.
This does the same thing as
add_handler()using theMessageReactionCountUpdatedHandler.Usable by Users Bots
- @pyrogram.Client.on_inline_query¶
Decorator for handling inline queries.
This does the same thing as
add_handler()using theInlineQueryHandler.Usable by Users Bots
- @pyrogram.Client.on_chosen_inline_result¶
Decorator for handling chosen inline results.
This does the same thing as
add_handler()using theChosenInlineResultHandler.Usable by Users Bots
- @pyrogram.Client.on_chat_member_updated¶
Decorator for handling event changes on chat members.
This does the same thing as
add_handler()using theChatMemberUpdatedHandler.Usable by Users Bots
- @pyrogram.Client.on_chat_join_request¶
Decorator for handling chat join requests.
This does the same thing as
add_handler()using theChatJoinRequestHandler.Usable by Users Bots
- @pyrogram.Client.on_deleted_messages¶
Decorator for handling deleted messages.
This does the same thing as
add_handler()using theDeletedMessagesHandler.Usable by Users Bots
- @pyrogram.Client.on_edited_bot_business_message¶
Decorator for handling edited messages.
This does the same thing as
add_handler()using theEditedBotBusinessMessageHandler.
- @pyrogram.Client.on_user_status¶
Decorator for handling user status updates.
This does the same thing as
add_handler()using theUserStatusHandler.Usable by Users Bots
- @pyrogram.Client.on_story¶
Decorator for handling new stories.
This does the same thing as
add_handler()using theStoryHandler.
- @pyrogram.Client.on_poll¶
Decorator for handling poll updates.
This does the same thing as
add_handler()using thePollHandler.Usable by Users Bots
- @pyrogram.Client.on_disconnect¶
Decorator for handling disconnections.
This does the same thing as
add_handler()using theDisconnectHandler.Usable by Users Bots
- @pyrogram.Client.on_invoke_err¶
Decorator for handling errors of invoke().
This does the same thing as
add_handler()using theInvokeErrHandler.Usable by Users Bots
- @pyrogram.Client.on_raw_update¶
Decorator for handling raw updates.
This does the same thing as
add_handler()using theRawUpdateHandler.Usable by Users Bots