Visitar URL original
Update docs · dotlambda/pyrogram@303712f · GitHub
Skip to content

Commit 303712f

Browse files
committed
Update docs
1 parent 5f087e5 commit 303712f

14 files changed

Lines changed: 110 additions & 49 deletions

File tree

‎compiler/docs/template/bound-methods.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ some of the required arguments.
1515
1616
@app.on_message()
1717
def hello(client, message)
18-
message.reply("hi")
18+
message.reply_text("hi")
1919
2020
2121
app.run()

‎compiler/docs/template/types.rst‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
Available Types
22
===============
33

4-
This page is about Pyrogram types. All types listed here are accessible through the main package directly.
4+
This page is about Pyrogram types. All types listed here are accessible through ``types`` package.
55

66
.. code-block:: python
77
:emphasize-lines: 1
88
9-
from pyrogram import User, Message, ...
9+
from pyrogram.types import User, Message, ...
1010
1111
.. note::
1212

‎docs/source/api/handlers.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Handlers are used to instruct Pyrogram about which kind of updates you'd like to
55
For a much more convenient way of registering callback functions have a look at :doc:`Decorators <decorators>` instead.
66

77
.. code-block:: python
8-
:emphasize-lines: 1, 10
8+
:emphasize-lines: 2, 11
99
1010
from pyrogram import Client
1111
from pyrogram.handlers import MessageHandler

‎docs/source/intro/install.rst‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@ Pyrogram is always evolving, although new releases on PyPI are published only wh
4040
doesn't mean you can't try new features right now!
4141

4242
In case you'd like to try out the latest Pyrogram features, the `GitHub repo`_ is always kept updated with new changes;
43-
you can install the development version straight from the ``develop`` branch using this command (note "develop.zip" in
43+
you can install the development version straight from the ``master`` branch using this command (note "master.zip" in
4444
the link):
4545

4646
.. code-block:: text
4747
48-
$ pip3 install -U https://github.com/pyrogram/pyrogram/archive/develop.zip
48+
$ pip3 install -U https://github.com/pyrogram/pyrogram/archive/master.zip
4949
5050
Verifying
5151
---------

‎docs/source/intro/quickstart.rst‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
Quick Start
22
===========
33

4-
The next few steps serve as a quick start for all new Pyrogrammers that want to see Pyrogram in action as fast as
5-
possible. Let's go!
4+
The next few steps serve as a quick start for all new :term:`Pyrogrammers <Pyrogrammer>` that want to see Pyrogram in
5+
action as fast as possible. Let's go!
66

77
Get Pyrogram Real Fast
88
----------------------

‎docs/source/start/errors.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Error Handling
22
==============
33

4-
Errors are inevitable when working with the API, and they must be correctly handled with ``try..except`` blocks in order
4+
Errors are inevitable when working with the API, and they can be correctly handled with ``try...except`` blocks in order
55
to control the behaviour of your application. Pyrogram errors all live inside the ``errors`` package:
66

77
.. code-block:: python

‎docs/source/start/examples/bot_keyboards.rst‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ like send_audio(), send_document(), send_location(), etc...
1111

1212
.. code-block:: python
1313
14-
from pyrogram import Client, ReplyKeyboardMarkup, InlineKeyboardMarkup, InlineKeyboardButton
14+
from pyrogram import Client
15+
from pyrogram.types import ReplyKeyboardMarkup, InlineKeyboardMarkup, InlineKeyboardButton
1516
1617
# Create a client using your bot token
1718
app = Client("my_bot", bot_token="123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11")

‎docs/source/start/examples/echobot.rst‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@ echobot
33

44
This simple echo bot replies to every private text message.
55

6-
It uses the @on_message decorator to register a MessageHandler and applies two filters on it:
7-
Filters.text and Filters.private to make sure it will reply to private text messages only.
6+
It uses the ``@on_message`` decorator to register a ``MessageHandler`` and applies two filters on it:
7+
``filters.text`` and ``filters.private`` to make sure it will reply to private text messages only.
88

99
.. code-block:: python
1010
11-
from pyrogram import Client, Filters
11+
from pyrogram import Client, filters
1212
1313
app = Client("my_account")
1414
1515
16-
@app.on_message(Filters.text & Filters.private)
16+
@app.on_message(filters.text & filters.private)
1717
def echo(client, message):
18-
message.reply(message.text)
18+
message.reply_text(message.text)
1919
2020
2121
app.run() # Automatically start() and idle()

‎docs/source/start/examples/inline_queries.rst‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ It uses the @on_inline_query decorator to register an InlineQueryHandler.
88

99
.. code-block:: python
1010
11-
from pyrogram import (
12-
Client, InlineQueryResultArticle, InputTextMessageContent, InlineKeyboardMarkup, InlineKeyboardButton
13-
)
11+
from pyrogram import Client
12+
from pyrogram.types import (InlineQueryResultArticle, InputTextMessageContent,
13+
InlineKeyboardMarkup, InlineKeyboardButton)
1414
1515
app = Client("my_bot", bot_token="123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11")
1616
Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
welcomebot
22
==========
33

4-
This is the Welcome Bot in @PyrogramChat.
5-
6-
It uses the Emoji module to easily add emojis in your text messages and Filters
4+
This example uses the ``emoji`` module to easily add emoji in your text messages and ``filters``
75
to make it only work for specific messages in a specific chat.
86

97
.. code-block:: python
108
11-
from pyrogram import Client, Emoji, Filters
9+
from pyrogram import Client, emoji, filters
1210
1311
TARGET = "PyrogramChat" # Target chat. Can also be a list of multiple chat ids/usernames
1412
MENTION = "[{}](tg://user?id={})" # User mention markup
@@ -18,16 +16,16 @@ to make it only work for specific messages in a specific chat.
1816
1917
2018
# Filter in only new_chat_members updates generated in TARGET chat
21-
@app.on_message(Filters.chat(TARGET) & Filters.new_chat_members)
19+
@app.on_message(filters.chat(TARGET) & filters.new_chat_members)
2220
def welcome(client, message):
2321
# Build the new members list (with mentions) by using their first_name
24-
new_members = [MENTION.format(i.first_name, i.id) for i in message.new_chat_members]
22+
new_members = [u.mention for u in message.new_chat_members]
2523
2624
# Build the welcome message by using an emoji and the list we built above
27-
text = MESSAGE.format(Emoji.SPARKLES, ", ".join(new_members))
25+
text = MESSAGE.format(emoji.SPARKLES, ", ".join(new_members))
2826
2927
# Send the welcome message, without the web page preview
30-
message.reply(text, disable_web_page_preview=True)
28+
message.reply_text(text, disable_web_page_preview=True)
3129
3230
3331
app.run() # Automatically start() and idle()

0 commit comments

Comments
 (0)