Skip to content

Commit

Permalink
Documentation Revamp Update
Browse files Browse the repository at this point in the history
  • Loading branch information
SpEcHiDe committed Mar 3, 2024
1 parent 194c44d commit 3cb4777
Show file tree
Hide file tree
Showing 12 changed files with 40 additions and 28 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ api:

docs-live:
make clean-docs
make api
cd compiler/docs && ../../$(PYTHON) compiler.py
$(RM) docs/source/telegram
$(VENV)/bin/sphinx-autobuild \
--watch pyrogram --watch docs/resources \
-b html "docs/source" "docs/build/html" -j auto
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,14 @@
</p>

## WARNING
We've made faster-pyrogram publicly available in order to facilitate conversation about potentially upstreaming some of this work to Pyrogram and to reduce duplication of effort among people working on Pyrogram performance.
We've made [faster-pyrogram](https://github.com/cavallium/faster-pyrogram) publicly available in order to facilitate conversation about potentially upstreaming some of this work to Pyrogram and to reduce duplication of effort among people working on Pyrogram performance.

> Elegant, modern and asynchronous Telegram MTProto API framework in Python for users and bots
We merge changes made to few of pyrogram forks plus changes made by us to this repository. All the features are just customized feature mostly for personal use; there is no guarantee in them being stable, __USE AT YOUR OWN RISK__.

**WARNING**: We merge changes made to few of pyrogram forks plus changes made by us to this repository. All the features are just customized feature mostly for personal use; there is no guarantee in them being stable, __USE AT YOUR OWN RISK__.
All of the repositories that we merge features from are listed in [Release Notes](https://telegramplayground.github.io/pyrogram/releases/changes-in-this-fork.html) file.

> Elegant, modern and asynchronous Telegram MTProto API framework in Python for users and bots
``` python
from pyrogram import Client, filters

Expand Down
16 changes: 10 additions & 6 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ Welcome to Pyrogram

<div align="center">
<a href="/">
<div class="pyrogram-logo-index"><img src="_static/pyrogram.png" alt="Pyrogram"></div>
<div class="pyrogram-logo-index">
<img src="_static/pyrogram.png" alt="Pyrogram">
</div>
<div class="pyrogram-text pyrogram-text-index">Pyrogram</div>
</a>
</div>
Expand All @@ -22,6 +24,10 @@ Welcome to Pyrogram
Development
</a>
<a href="./releases/">
Releases
</a>
<a href="https://t.me/pyrogram">
News
</a>
Expand All @@ -33,12 +39,10 @@ Welcome to Pyrogram
app = Client("my_account")
@app.on_message(filters.private)
async def hello(client, message):
await message.reply("Hello from Pyrogram!")
app.run()
**Pyrogram** is a modern, elegant and asynchronous :doc:`MTProto API <topics/mtproto-vs-botapi>` framework.
Expand All @@ -53,7 +57,7 @@ It enables you to easily interact with the main Telegram API through a user acco
.. admonition :: USE AT YOUR OWN RISK
:class: tip
All of the repositories that we merge features from are listed in `Release Notes <https://telegramplayground.github.io/pyrogram/releases/changes-in-this-fork.html>`_ file.
All of the repositories that we merge features from are listed in :doc:`Release Notes <releases/changes-in-this-fork>` file.
Support
Expand Down Expand Up @@ -92,7 +96,7 @@ API Reference
.. hlist::
:columns: 1

- :doc:`Pyrogram Mod Client <api/client>`: Reference details about the Client class.
- :doc:`Pyrogram Client <api/client>`: Reference details about the Client class.
- :doc:`Available Methods <api/methods/index>`: List of available high-level methods.
- :doc:`Available Types <api/types/index>`: List of available high-level types.
- :doc:`Enumerations <api/enums/index>`: List of available enumerations.
Expand Down Expand Up @@ -133,7 +137,6 @@ Meta
api/client
api/methods/index
api/types/index
api/storage/index
api/bound-methods/index
api/enums/index
api/handlers
Expand All @@ -151,6 +154,7 @@ Meta
topics/client-settings
topics/speedups
topics/text-formatting
topics/storage-engines
topics/synchronous
topics/smart-plugins
topics/serializing
Expand Down
24 changes: 12 additions & 12 deletions docs/source/releases/changes-in-this-fork.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ in reverse chronological order. You should read this when upgrading
to this fork to know where your code can break, and where
it can take advantage of new goodies!

`For a more detailed description, you can check the commits. <https://github.com/TelegramPlayGround/pyrogram/>`_
`For a more detailed description, please check the commits. <https://github.com/TelegramPlayGround/pyrogram/>`_

+-------------+
| PmOItrOAe |
Expand All @@ -15,7 +15,7 @@ it can take advantage of new goodies!
- Add ``link`` parameter in :meth:`~pyrogram.Client.get_messages`
- `fix(filters): add type hints in filters.py <https://github.com/TelegramPlayGround/pyrogram/pull/8>`_
- Documentation Builder Fixes
- `faster-pyrogram <https://github.com/TelegramPlayGround/pyrogram/pull/6>`_ is not polished or documented for anyone else's use. We don't have the capacity to support `faster-pyrogram <https://github.com/TelegramPlayGround/pyrogram/pull/6>`_ as an independent open-source project, nor any desire for it to become an alternative to Pyrogram. Our goal in making this code available is a unified faster Pyrogram. `... <https://github.com/cavallium/faster-pyrogram/blob/b781909/README.md#L28>`_
- `faster-pyrogram <https://github.com/cavallium/faster-pyrogram>`_ is not polished or documented for anyone else's use. We don't have the capacity to support `faster-pyrogram <https://github.com/TelegramPlayGround/pyrogram/pull/6>`_ as an independent open-source project, nor any desire for it to become an alternative to Pyrogram. Our goal in making this code available is a unified faster Pyrogram. `... <https://github.com/cavallium/faster-pyrogram/blob/b781909/README.md#L28>`_
- Lock-free and asynchronous implementation of the sqlite session.
- The possibility of turning off journaling and vacuum when starting a session.
- Improved implementation of rle_encode.
Expand All @@ -29,7 +29,7 @@ it can take advantage of new goodies!

- `Add ttl_seconds attribute to Voice and VideoNote class <https://github.com/KurimuzonAkuma/pyrogram/commit/7556d3e3864215386f018692947cdf52a82cb420>`_
- `#713 <https://github.com/pyrogram/pyrogram/pull/713>`_
- Removed :obj:`~pyrogram.types.ChatPreview` class.
- Removed :obj:`~pyrogram.types.ChatPreview` class, and merged the parameters with the :obj:`~pyrogram.types.Chat` class.
- Added ``description``, ``accent_color_id``, ``is_verified``, ``is_scam``, ``is_fake``, ``is_public``, ``join_by_request`` attributes to the class :obj:`~pyrogram.types.ChatPreview`.
- Added ``force_full`` parameter to :meth:`~pyrogram.Client.get_chat`.
- Bug Fix for :meth:`~pyrogram.Client.get_chat` and :meth:`~pyrogram.Client.join_chat` when ``https://t.me/username`` was passed.
Expand Down Expand Up @@ -75,25 +75,25 @@ it can take advantage of new goodies!
- Added missing attributes ``added_to_attachment_menu``, ``is_attachment_menu_adding_available``, ``can_join_groups``, ``can_read_all_group_messages``, ``supports_inline_queries``, ``can_be_contacted_with_premium`` to the :obj:`~pyrogram.types.User`.
- Migrate project to ``pyproject.toml`` from ``setup.py``.
- PRs from upstream: `1366 <https://github.com/pyrogram/pyrogram/pull/1366>`_, `1305 <https://github.com/pyrogram/pyrogram/pull/1305>`_, `1288 <https://github.com/pyrogram/pyrogram/pull/1288>`_, `1262 <https://github.com/pyrogram/pyrogram/pull/1262>`_, `1253 <https://github.com/pyrogram/pyrogram/pull/1253>`_, `1234 <https://github.com/pyrogram/pyrogram/pull/1234>`_, `1210 <https://github.com/pyrogram/pyrogram/pull/1210>`_, `1201 <https://github.com/pyrogram/pyrogram/pull/1201>`_, `1197 <https://github.com/pyrogram/pyrogram/pull/1197>`_, `1143 <https://github.com/pyrogram/pyrogram/pull/1143>`_, `1059 <https://github.com/pyrogram/pyrogram/pull/1059>`_.
- Bug fix for :obj:`~pyrogram.Client.send_audio` and :obj:`~pyrogram.Client.send_voice`. (Thanks to `... <https://t.me/c/1220993104/1360174>`_).
- Add `waveform` parameter to :obj:`~pyrogram.Client.send_voice`.
- Added `view_once` parameter to :obj:`~pyrogram.Client.send_photo`, :obj:`~pyrogram.Client.send_video`, :obj:`~pyrogram.Client.send_video_note`, :obj:`~pyrogram.Client.send_voice`.
- Bug fix for :meth:`~pyrogram.Client.send_audio` and :meth:`~pyrogram.Client.send_voice`. (Thanks to `... <https://t.me/c/1220993104/1360174>`_).
- Add `waveform` parameter to :meth:`~pyrogram.Client.send_voice`.
- Added `view_once` parameter to :meth:`~pyrogram.Client.send_photo`, :meth:`~pyrogram.Client.send_video`, :meth:`~pyrogram.Client.send_video_note`, :meth:`~pyrogram.Client.send_voice`.
- Add missing parameters to :obj:`~pyrogram.types.Message.reply_photo`, :obj:`~pyrogram.types.Message.reply_video`, :obj:`~pyrogram.types.Message.reply_video_note`, :obj:`~pyrogram.types.Message.reply_voice`.

+------------------------+
| Scheme layer used: 170 |
+------------------------+

- Stole documentation from `https://github.com/PyrogramMod/PyrogramMod`.
- Removed `send_reaction` and Added `set_message_reaction`.
- Added support for voice, photo, video, animation messages that could be played once.
- Stole documentation from `PyrogramMod <https://github.com/PyrogramMod/PyrogramMod>`_.
- Renamed ``send_reaction`` to :meth:`~pyrogram.Client.set_message_reaction`.
- Added support for :meth:`~pyrogram.Client.send_photo`, :meth:`~pyrogram.Client.send_video`, :meth:`~pyrogram.Client.send_animation`, :meth:`~pyrogram.Client.send_voice` messages that could be played once.
- Added ``_raw`` to the :obj:`~pyrogram.types.Chat` object.
- Added the field ``via_chat_folder_invite_link`` to the class :obj:`~pyrogram.types.ChatMemberUpdated`.
- **BOTS ONLY**: Added updates about a reaction change on a message with non-anonymous reactions, represented by the class :obj:`~pyrogram.handlers.MessageReactionUpdatedHandler` and the field ``message_reaction`` in the class Update.
- **BOTS ONLY**: Added updates about reaction changes on a message with anonymous reactions, represented by the class :obj:`~pyrogram.handlers.MessageReactionCountUpdatedHandler` and the field ``message_reaction_count`` in the class Update.
- Replaced the parameter ``disable_web_page_preview`` with :obj:`~pyrogram.types.LinkPreviewOptions` in the methods sendMessage and editMessageText.
- Replaced the field ``disable_web_page_preview`` with :obj:`~pyrogram.types.LinkPreviewOptions` in the class InputTextMessageContent.
- Added missing parameters to :obj:`~pyrogram.Client.forward_messages`.
- Replaced the parameter ``disable_web_page_preview`` with :obj:`~pyrogram.types.LinkPreviewOptions` in the methods :meth:`~pyrogram.Client.send_message` and :meth:`~pyrogram.Client.edit_message_text`.
- Replaced the field ``disable_web_page_preview`` with :obj:`~pyrogram.types.LinkPreviewOptions` in the class :obj:`~pyrogram.types.InputTextMessageContent`.
- Added missing parameters to :meth:`~pyrogram.Client.forward_messages`.
- Added the class :obj:`~pyrogram.types.ReplyParameters` and replaced parameters ``reply_to_message_id`` in the methods :meth:`~pyrogram.Client.copy_message`, :meth:`~pyrogram.Client.forward_messages`, :meth:`~pyrogram.Client.send_message`, :meth:`~pyrogram.Client.send_photo`, :meth:`~pyrogram.Client.send_video`, :meth:`~pyrogram.Client.send_animation`, :meth:`~pyrogram.Client.send_audio`, :meth:`~pyrogram.Client.send_document`, :meth:`~pyrogram.Client.send_sticker`, :meth:`~pyrogram.Client.send_video_note`, :meth:`~pyrogram.Client.send_voice`, :meth:`~pyrogram.Client.send_location`, :meth:`~pyrogram.Client.send_venue`, :meth:`~pyrogram.Client.send_contact`, :meth:`~pyrogram.Client.send_poll`, :meth:`~pyrogram.Client.send_dice`, :meth:`~pyrogram.Client.send_game`, :meth:`~pyrogram.Client.send_media_group`, :meth:`~pyrogram.Client.copy_media_group`, :meth:`~pyrogram.Client.send_inline_bot_result`, :meth:`~pyrogram.Client.send_cached_media`, and the corresponding reply_* methods with the field ``reply_parameters`` of type :obj:`~pyrogram.types.ReplyParameters`.
- Bug fixes for sending ``ttl_seconds`` and ``has_spoiler``.

Expand Down
3 changes: 2 additions & 1 deletion docs/source/start/examples/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ to give you a basic idea.
:doc:`inline_queries`, "Handle inline queries (as bot) and answer with results"
:doc:`use_inline_bots`, "Query an inline bot (as user) and send a result to a chat"
:doc:`bot_keyboards`, "Send normal and inline keyboards using regular bots"
:doc:`send_voice`, "Download audio file and reupload as Voice Message with waveforms"
:doc:`raw_updates`, "Handle raw updates (old, should be avoided)"
:doc:`send_voice_message`, "Download audio file and reupload as Voice Message with waveforms"

For more advanced examples, see https://github.com/ColinShark/Pyrogram-Snippets.

Expand All @@ -44,4 +44,5 @@ For more advanced examples, see https://github.com/ColinShark/Pyrogram-Snippets.
inline_queries
use_inline_bots
bot_keyboards
send_voice
raw_updates
File renamed without changes.
5 changes: 4 additions & 1 deletion docs/source/start/examples/welcome_bot.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,13 @@ to make it only work for specific messages in a specific chat.
# Filter in only new_chat_members updates generated in TARGET chat
@app.on_chat_member_updated(filters.chat(TARGET) & filters.new_chat_members)
@app.on_chat_member_updated(filters.chat(TARGET))
async def welcome(client, chat_member_updated):
if chat_member_updated.old_chat_member:
return # it's not a new join
# Build the new members list (with mentions) by using their first_name
new_member = chat_member_updated.new_chat_member.user.mention
added_by = message.from_user.id # is equal to new_member if user wasn't added
# Build the welcome message by using an emoji and the list we built above
text = MESSAGE.format(emoji.SPARKLES, new_member)
# send a message to the chat
Expand Down
Loading

0 comments on commit 3cb4777

Please sign in to comment.