mirror of
https://github.com/TeamPGM/pyrogram.git
synced 2024-11-16 12:51:18 +00:00
Add callback_query_handler.py example
This commit is contained in:
parent
e8b708b35d
commit
735dfb6a0c
@ -15,4 +15,5 @@ you can simply copy-paste and run, the only things you have to change are your s
|
||||
- [**get_participants2.py**](get_participants2.py)
|
||||
- [**query_inline_bots.py**](query_inline_bots.py)
|
||||
- [**send_bot_keyboards.py**](send_bot_keyboards.py)
|
||||
- [**callback_query_handler.py**](callback_query_handler.py)
|
||||
- [**raw_update_handler.py**](raw_update_handler.py)
|
||||
|
20
examples/callback_query_handler.py
Normal file
20
examples/callback_query_handler.py
Normal file
@ -0,0 +1,20 @@
|
||||
from pyrogram import Client
|
||||
|
||||
"""This example shows how to handle callback queries, i.e.: queries coming from inline button presses.
|
||||
|
||||
It uses the @on_callback_query decorator to register a CallbackQueryHandler."""
|
||||
|
||||
app = Client("123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11")
|
||||
|
||||
|
||||
@app.on_callback_query()
|
||||
def answer(client, callback_query):
|
||||
client.answer_callback_query(
|
||||
callback_query.id,
|
||||
text='Button contains: "{}"'.format(callback_query.data),
|
||||
show_alert=True
|
||||
)
|
||||
|
||||
|
||||
app.start()
|
||||
app.idle()
|
Loading…
Reference in New Issue
Block a user