Update examples
This commit is contained in:
parent
d48f18bea5
commit
f16ed40532
@ -12,12 +12,12 @@ Example | Description
|
|||||||
---: | :---
|
---: | :---
|
||||||
[**hello_world**](hello_world.py) | Demonstration of basic API usage
|
[**hello_world**](hello_world.py) | Demonstration of basic API usage
|
||||||
[**echobot**](echobot.py) | Echo every private text message
|
[**echobot**](echobot.py) | Echo every private text message
|
||||||
[**welcome**](welcome.py) | The Welcome Bot in [@PyrogramChat](https://t.me/pyrogramchat)
|
[**welcomebot**](welcomebot.py) | The Welcome Bot in [@PyrogramChat](https://t.me/pyrogramchat)
|
||||||
[**history**](history.py) | Get the full message history of a chat
|
[**get_history**](get_history.py) | Get the full message history of a chat
|
||||||
[**chat_members**](chat_members.py) | Get all the members of a chat
|
[**get_chat_members**](get_chat_members.py) | Get all the members of a chat
|
||||||
[**dialogs**](dialogs.py) | Get all of your dialog chats
|
[**get_dialogs**](get_dialogs.py) | Get all of your dialog chats
|
||||||
[**using_inline_bots**](using_inline_bots.py) | Query an inline bot (as user) and send a result to a chat
|
[**callback_queries**](callback_queries.py) | Handle callback queries (as bot) coming from inline button presses
|
||||||
[**keyboards**](keyboards.py) | Send normal and inline keyboards using regular bots
|
[**inline_queries**](inline_queries.py) | Handle inline queries (as bot) and answer with results
|
||||||
[**callback_queries**](callback_queries.py) | Handle queries coming from inline button presses
|
[**use_inline_bots**](use_inline_bots.py) | Query an inline bot (as user) and send a result to a chat
|
||||||
[**inline_queries**](inline_queries.py) | Handle inline queries
|
[**bot_keyboards**](bot_keyboards.py) | Send normal and inline keyboards using regular bots
|
||||||
[**raw_updates**](raw_updates.py) | Handle raw updates (old, should be avoided)
|
[**raw_updates**](raw_updates.py) | Handle raw updates (old, should be avoided)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
"""This example will show you how to send normal and inline keyboards.
|
"""This example will show you how to send normal and inline keyboards (as bot).
|
||||||
|
|
||||||
You must log-in as a regular bot in order to send keyboards (use the token from @BotFather).
|
You must log-in as a regular bot in order to send keyboards (use the token from @BotFather).
|
||||||
Any attempt in sending keyboards with a user account will be simply ignored by the server.
|
Any attempt in sending keyboards with a user account will be simply ignored by the server.
|
@ -1,4 +1,4 @@
|
|||||||
"""This example shows how to get the full dialogs list of a user."""
|
"""This example shows how to get the full dialogs list (as user)."""
|
||||||
|
|
||||||
from pyrogram import Client
|
from pyrogram import Client
|
||||||
|
|
13
examples/use_inline_bots.py
Normal file
13
examples/use_inline_bots.py
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
"""This example shows how to query an inline bot (as user)"""
|
||||||
|
|
||||||
|
from pyrogram import Client
|
||||||
|
|
||||||
|
# Create a new Client
|
||||||
|
app = Client("my_account")
|
||||||
|
|
||||||
|
with app:
|
||||||
|
# Get bot results for "Fuzz Universe" from the inline bot @vid
|
||||||
|
bot_results = app.get_inline_bot_results("vid", "Fuzz Universe")
|
||||||
|
|
||||||
|
# Send the first result (bot_results.results[0]) to your own chat (Saved Messages)
|
||||||
|
app.send_inline_bot_result("me", bot_results.query_id, bot_results.results[0].id)
|
@ -1,17 +0,0 @@
|
|||||||
"""This example shows how to query an inline bot"""
|
|
||||||
|
|
||||||
from pyrogram import Client
|
|
||||||
|
|
||||||
# Create a new Client
|
|
||||||
app = Client("my_account")
|
|
||||||
|
|
||||||
# Start the Client
|
|
||||||
app.start()
|
|
||||||
|
|
||||||
# Get bot results for "Fuzz Universe" from the inline bot @vid
|
|
||||||
bot_results = app.get_inline_bot_results("vid", "Fuzz Universe")
|
|
||||||
# Send the first result (bot_results.results[0]) to your own chat (Saved Messages)
|
|
||||||
app.send_inline_bot_result("me", bot_results.query_id, bot_results.results[0].id)
|
|
||||||
|
|
||||||
# Stop the client
|
|
||||||
app.stop()
|
|
Loading…
Reference in New Issue
Block a user