mirror of
https://github.com/pyrogram/pyrogram
synced 2025-08-31 06:16:06 +00:00
Allow accessing Object fields using square brackets
This commit is contained in:
@@ -26,15 +26,15 @@ ask you to input the phone code manually.
|
||||
return code # Must be string, e.g., "12345"
|
||||
|
||||
|
||||
client = Client(
|
||||
app = Client(
|
||||
session_name="example",
|
||||
phone_number="39**********",
|
||||
phone_code=phone_code_callback,
|
||||
password="password" # (if you have one)
|
||||
)
|
||||
|
||||
client.start()
|
||||
print(client.get_me())
|
||||
app.start()
|
||||
print(app.get_me())
|
||||
|
||||
Sign Up
|
||||
-------
|
||||
@@ -52,7 +52,7 @@ Telegram account in case the phone number you passed is not registered yet.
|
||||
return code # Must be string, e.g., "12345"
|
||||
|
||||
|
||||
client = Client(
|
||||
app = Client(
|
||||
session_name="example",
|
||||
phone_number="39**********",
|
||||
phone_code=phone_code_callback,
|
||||
@@ -60,5 +60,5 @@ Telegram account in case the phone number you passed is not registered yet.
|
||||
last_name="" # Can be an empty string
|
||||
)
|
||||
|
||||
client.start()
|
||||
print(client.get_me())
|
||||
app.start()
|
||||
print(app.get_me())
|
@@ -13,7 +13,7 @@ Inline Bots
|
||||
.. code-block:: python
|
||||
|
||||
# Get bot results for "Fuzz Universe" from the inline bot @vid
|
||||
bot_results = client.get_inline_bot_results("vid", "Fuzz Universe")
|
||||
bot_results = app.get_inline_bot_results("vid", "Fuzz Universe")
|
||||
|
||||
.. figure:: https://i.imgur.com/IAqLs54.png
|
||||
:width: 90%
|
||||
@@ -29,7 +29,7 @@ Inline Bots
|
||||
.. code-block:: python
|
||||
|
||||
# Send the first result (bot_results.results[0]) to your own chat (Saved Messages)
|
||||
client.send_inline_bot_result("me", bot_results.query_id, bot_results.results[0].id)
|
||||
app.send_inline_bot_result("me", bot_results.query_id, bot_results.results[0].id)
|
||||
|
||||
.. figure:: https://i.imgur.com/wwxr7B7.png
|
||||
:width: 90%
|
||||
|
@@ -32,7 +32,7 @@ Usage
|
||||
|
||||
from pyrogram import Client
|
||||
|
||||
client = Client(
|
||||
app = Client(
|
||||
session_name="example",
|
||||
proxy=dict(
|
||||
hostname="11.22.33.44",
|
||||
@@ -42,7 +42,7 @@ Usage
|
||||
)
|
||||
)
|
||||
|
||||
client.start()
|
||||
app.start()
|
||||
|
||||
...
|
||||
|
||||
|
@@ -56,7 +56,7 @@ Examples
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
client.send_message(
|
||||
app.send_message(
|
||||
chat_id="me",
|
||||
text=(
|
||||
"**bold**, "
|
||||
@@ -71,7 +71,7 @@ Examples
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
client.send_message(
|
||||
app.send_message(
|
||||
chat_id="me",
|
||||
text=(
|
||||
# Code block language is optional
|
||||
@@ -88,7 +88,7 @@ Examples
|
||||
|
||||
from pyrogram import ParseMode
|
||||
|
||||
client.send_message(
|
||||
app.send_message(
|
||||
chat_id="me",
|
||||
text=(
|
||||
"<b>bold</b>, <strong>bold</strong>, "
|
||||
|
@@ -54,7 +54,7 @@ Using Filters
|
||||
-------------
|
||||
|
||||
For a finer grained control over what kind of messages will be allowed or not in your callback functions, you can use
|
||||
:class:`Filters <pyrogram.Filters>`. The next example will show you how to handler only messages
|
||||
:class:`Filters <pyrogram.Filters>`. The next example will show you how to handle only messages
|
||||
containing an :obj:`Audio <pyrogram.api.types.pyrogram.Audio>` object:
|
||||
|
||||
.. code-block:: python
|
||||
@@ -97,7 +97,7 @@ Here are some examples:
|
||||
def my_handler(client, message):
|
||||
print(message)
|
||||
|
||||
- Message is a **sticker** **and** is coming from a **channel** or a **private** chat.
|
||||
- Message is a **sticker** **and** is coming from a **channel or** a **private** chat.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
@@ -119,7 +119,7 @@ can also accept arguments:
|
||||
def my_handler(client, message):
|
||||
print(message)
|
||||
|
||||
- Message is a **text** message matching the given regex pattern.
|
||||
- Message is a **text** message matching the given **regex** pattern.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
@@ -127,7 +127,7 @@ can also accept arguments:
|
||||
def my_handler(client, message):
|
||||
print(message)
|
||||
|
||||
More handlers using different filters can be created as well:
|
||||
More handlers using different filters can also live together:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
|
Reference in New Issue
Block a user