2
0
mirror of https://github.com/pyrogram/pyrogram synced 2025-08-31 14:25:55 +00:00

Update docs with new content

This commit is contained in:
Dan
2019-06-04 16:10:32 +02:00
parent 9a44c79a82
commit 1be8ca94cc
8 changed files with 295 additions and 131 deletions

View File

@@ -24,40 +24,40 @@ Making API method calls with Pyrogram is very simple. Here's an example we are g
app.stop()
Let's begin by importing the Client class from the Pyrogram package:
#. Let's begin by importing the Client class from the Pyrogram package:
.. code-block:: python
.. code-block:: python
from pyrogram import Client
from pyrogram import Client
Now instantiate a new Client object, "my_account" is a session name of your choice:
#. Now instantiate a new Client object, "my_account" is a session name of your choice:
.. code-block:: python
.. code-block:: python
app = Client("my_account")
app = Client("my_account")
To actually make use of any method, the client has to be started first:
#. To actually make use of any method, the client has to be started first:
.. code-block:: python
.. code-block:: python
app.start()
app.start()
Now, you can call any method you like:
#. Now, you can call any method you like:
.. code-block:: python
.. code-block:: python
print(app.get_me()) # Print information about yourself
print(app.get_me()) # Print information about yourself
# Send messages to yourself:
app.send_message("me", "Hi!") # Text message
app.send_location("me", 51.500729, -0.124583) # Location
app.send_sticker("me", "CAADBAADyg4AAvLQYAEYD4F7vcZ43AI") # Sticker
# Send messages to yourself:
app.send_message("me", "Hi!") # Text message
app.send_location("me", 51.500729, -0.124583) # Location
app.send_sticker("me", "CAADBAADyg4AAvLQYAEYD4F7vcZ43AI") # Sticker
Finally, when done, simply stop the client:
#. Finally, when done, simply stop the client:
.. code-block:: python
.. code-block:: python
app.stop()
app.stop()
Context Manager
---------------