diff --git a/examples/README.md b/examples/README.md index 643fe56d..b8898a71 100644 --- a/examples/README.md +++ b/examples/README.md @@ -12,12 +12,12 @@ Example | Description ---: | :--- [**hello_world**](hello_world.py) | Demonstration of basic API usage [**echobot**](echobot.py) | Echo every private text message -[**welcome**](welcome.py) | The Welcome Bot in [@PyrogramChat](https://t.me/pyrogramchat) -[**history**](history.py) | Get the full message history of a chat -[**chat_members**](chat_members.py) | Get all the members of a chat -[**dialogs**](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 -[**keyboards**](keyboards.py) | Send normal and inline keyboards using regular bots -[**callback_queries**](callback_queries.py) | Handle queries coming from inline button presses -[**inline_queries**](inline_queries.py) | Handle inline queries +[**welcomebot**](welcomebot.py) | The Welcome Bot in [@PyrogramChat](https://t.me/pyrogramchat) +[**get_history**](get_history.py) | Get the full message history of a chat +[**get_chat_members**](get_chat_members.py) | Get all the members of a chat +[**get_dialogs**](get_dialogs.py) | Get all of your dialog chats +[**callback_queries**](callback_queries.py) | Handle callback queries (as bot) coming from inline button presses +[**inline_queries**](inline_queries.py) | Handle inline queries (as bot) and answer with results +[**use_inline_bots**](use_inline_bots.py) | Query an inline bot (as user) and send a result to a chat +[**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) diff --git a/examples/keyboards.py b/examples/bot_keyboards.py similarity index 99% rename from examples/keyboards.py rename to examples/bot_keyboards.py index 1a1140b6..4cbe8eaa 100644 --- a/examples/keyboards.py +++ b/examples/bot_keyboards.py @@ -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). Any attempt in sending keyboards with a user account will be simply ignored by the server. diff --git a/examples/chat_members.py b/examples/get_chat_members.py similarity index 100% rename from examples/chat_members.py rename to examples/get_chat_members.py diff --git a/examples/dialogs.py b/examples/get_dialogs.py similarity index 72% rename from examples/dialogs.py rename to examples/get_dialogs.py index 08c769e2..92da8834 100644 --- a/examples/dialogs.py +++ b/examples/get_dialogs.py @@ -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 diff --git a/examples/history.py b/examples/get_history.py similarity index 100% rename from examples/history.py rename to examples/get_history.py diff --git a/examples/use_inline_bots.py b/examples/use_inline_bots.py new file mode 100644 index 00000000..5681df87 --- /dev/null +++ b/examples/use_inline_bots.py @@ -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) diff --git a/examples/using_inline_bots.py b/examples/using_inline_bots.py deleted file mode 100644 index c3b48874..00000000 --- a/examples/using_inline_bots.py +++ /dev/null @@ -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() diff --git a/examples/welcome.py b/examples/welcomebot.py similarity index 100% rename from examples/welcome.py rename to examples/welcomebot.py