Skip to content

Commit

Permalink
Various improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
delivrance committed Jan 7, 2022
1 parent 80d0966 commit 8c82884
Show file tree
Hide file tree
Showing 135 changed files with 836 additions and 1,416 deletions.
3 changes: 2 additions & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
github: delivrance
custom: https://docs.pyrogram.org/support
liberapay: delivrance
open_collective: pyrogram
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: Bug Report
about: Create a bug report affecting the library or the documentation
about: Create a bug report affecting the framework or the documentation
---

<!-- WARNING: Ignoring or altering this template could lead to the issue being closed as invalid -->
Expand Down
6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ blank_issues_enabled: false
contact_links:
- name: Ask Pyrogram related questions
url: https://stackoverflow.com/questions/tagged/pyrogram
about: This place is for issues about Pyrogram. If you'd like to ask a question, please do so at StackOverflow.
- name: Join the Telegram community
about: This place is only for reporting issues about Pyrogram. You can ask questions at StackOverflow.
- name: Join the Telegram channel
url: https://t.me/pyrogram
about: Join the official channel to stay tuned for news and updates.
about: Join the official channel and stay tuned for news, updates and announcements.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ labels: "enhancement"
<!-- WARNING: Ignoring or altering this template could lead to the issue being closed as invalid -->

## Checklist
- [ ] I believe the idea is awesome and would benefit the library.
- [ ] I believe the idea is awesome and would benefit the framework.
- [ ] I have searched in the issue tracker for similar requests, including closed ones.

## Description
Expand Down
58 changes: 27 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<p align="center">
<a href="https://github.com/pyrogram/pyrogram">
<img src="https://i.imgur.com/BOgY9ai.png" alt="Pyrogram">
<img src="https://docs.pyrogram.org/_static/pyrogram.png" alt="Pyrogram" width="128">
</a>
<br>
<b>Telegram MTProto API Framework for Python</b>
Expand All @@ -9,17 +9,19 @@
Documentation
</a>
<a href="https://github.com/pyrogram/pyrogram/releases">
<a href="https://docs.pyrogram.org/releases">
Releases
</a>
<a href="https://t.me/Pyrogram">
Community
<a href="https://t.me/pyrogram">
News
</a>
</p>

## Pyrogram

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

Expand All @@ -28,34 +30,33 @@ app = Client("my_account")

@app.on_message(filters.private)
async def hello(client, message):
await message.reply_text(f"Hello {message.from_user.mention}")
await message.reply("Hello from Pyrogram!")


app.run()
```

**Pyrogram** is a modern, elegant and easy-to-use [Telegram](https://telegram.org/) client library framework written
from the ground up in Python and C. It enables you to easily create custom Telegram client applications for both user
and bot identities (bot API alternative) via the [MTProto API](https://docs.pyrogram.org/topics/mtproto-vs-botapi).
**Pyrogram** is a modern, elegant and asynchronous [MTProto API](https://docs.pyrogram.org/topics/mtproto-vs-botapi)
framework. It enables you to easily interact with the main Telegram API through a user account (custom client) or a bot
identity (bot API alternative) using Python.

### Features
### Support

- **Easy**: You can install Pyrogram with pip and start building your applications right away.
- **Elegant**: Low-level details are abstracted and re-presented in a much nicer and easier way.
- **Fast**: Crypto parts are boosted up by [TgCrypto](https://github.com/pyrogram/tgcrypto), a high-performance library
written in pure C.
- **Asynchronous**: Allows both synchronous and asynchronous models to fit all usage needs.
- **Documented**: API methods, types and public interfaces are all [well documented](https://docs.pyrogram.org).
- **Type-hinted**: Types and methods are all type-hinted, enabling excellent editor support.
- **Updated**, to make use of the latest Telegram API version and features.
- **Bot API-like**: Similar to the Bot API in its simplicity, but much more powerful and detailed.
- **Pluggable**: The Smart Plugin system allows to write components with minimal boilerplate code.
- **Comprehensive**: Execute any advanced action an official client is able to do, and even more.
If you'd like to support Pyrogram, you can consider:

- [Become a GitHub sponsor](https://github.com/sponsors/delivrance).
- [Become a LiberaPay patron](https://liberapay.com/delivrance).
- [Become an OpenCollective backer](https://opencollective.com/pyrogram>).

### Requirements
### Key Features

- Python 3.6 or higher.
- A [Telegram API key](https://docs.pyrogram.org/intro/setup#api-keys).
- **Ready**: Install Pyrogram with pip and start building your applications right away.
- **Easy**: Makes the Telegram API simple and intuitive, while still allowing advanced usages.
- **Elegant**: Low-level details are abstracted and re-presented in a more convenient way.
- **Fast**: Boosted up by [TgCrypto](https://github.com/pyrogram/tgcrypto), a high-performance crypto library written in pure C.
- **Type-hinted**: Types and methods are all type-hinted, enabling excellent editor support.
- **Async**: Fully asynchronous (also usable synchronously if wanted, for convenience).
- **Powerful**: Full access to Telegram's API to execute any official client action and more.

### Installing

Expand All @@ -65,11 +66,6 @@ pip3 install pyrogram

### Resources

- The docs contain lots of resources to help you get started with Pyrogram: https://docs.pyrogram.org.
- Seeking extra help? Come join and ask our community: https://t.me/pyrogram.
- For other kind of inquiries, you can send a [message](https://t.me/haskell) or an [e-mail](mailto:[email protected]).

### Copyright & License

- Copyright (C) 2017-2021 Dan <<https://github.com/delivrance>>
- Licensed under the terms of the [GNU Lesser General Public License v3 or later (LGPLv3+)](COPYING.lesser)
- Check out the docs at https://docs.pyrogram.org to learn more about Pyrogram, get started right
away and discover more in-depth material for building your client applications.
- Join the official channel at https://t.me/pyrogram and stay tuned for news, updates and announcements.
8 changes: 8 additions & 0 deletions compiler/docs/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ def get_title_list(s: str) -> list:
send_venue
send_contact
send_cached_media
send_reaction
edit_message_text
edit_message_caption
edit_message_media
Expand All @@ -180,7 +181,9 @@ def get_title_list(s: str) -> list:
retract_vote
send_dice
search_messages
search_messages_count
search_global
search_global_count
download_media
get_discussion_message
""",
Expand Down Expand Up @@ -284,6 +287,7 @@ def get_title_list(s: str) -> list:
send_game
set_game_score
get_game_high_scores
set_bot_commands
""",
authorization="""
Authorization
Expand Down Expand Up @@ -360,6 +364,7 @@ def get_title_list(s: str) -> list:
ChatEvent
ChatEventFilter
ChatMemberUpdated
ChatJoinRequest
Dialog
Restriction
""",
Expand All @@ -384,6 +389,7 @@ def get_title_list(s: str) -> list:
Poll
PollOption
Dice
Reaction
VoiceChatScheduled
VoiceChatStarted
VoiceChatEnded
Expand Down Expand Up @@ -420,6 +426,8 @@ def get_title_list(s: str) -> list:
InlineQueryResultArticle
InlineQueryResultPhoto
InlineQueryResultAnimation
InlineQueryResultAudio
InlineQueryResultVideo
ChosenInlineResult
""",
input_message_content="""
Expand Down
7 changes: 3 additions & 4 deletions compiler/docs/template/bound-methods.rst
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
Bound Methods
=============

Some Pyrogram types define what are called bound methods. Bound methods are functions attached to a class which are
accessed via an instance of that class. They make it even easier to call specific methods by automatically inferring
Some Pyrogram types define what are called bound methods. Bound methods are functions attached to a type which are
accessed via an instance of that type. They make it even easier to call specific methods by automatically inferring
some of the required arguments.

.. code-block:: python
:emphasize-lines: 8
from pyrogram import Client
Expand All @@ -15,7 +14,7 @@ some of the required arguments.
@app.on_message()
def hello(client, message)
message.reply_text("hi")
message.reply("hi")
app.run()
Expand Down
7 changes: 3 additions & 4 deletions compiler/docs/template/methods.rst
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
Available Methods
=================

This page is about Pyrogram methods. All the methods listed here are bound to a :class:`~pyrogram.Client` instance,
except for :meth:`~pyrogram.idle()`, which is a special function that can be found in the main package directly.
This page is about Pyrogram methods. All the methods listed here are bound to a :class:`~pyrogram.Client` instance.
Some other utility functions can instead be found in the main package directly.

.. code-block:: python
:emphasize-lines: 6
from pyrogram import Client
app = Client("my_account")
with app:
app.send_message("haskell", "hi")
app.send_message("me", "hi")
.. contents:: Contents
:backlinks: none
Expand Down
1 change: 0 additions & 1 deletion compiler/docs/template/types.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ Unless required as argument to a client method, most of the types don't need to
are only returned by other methods. You also don't need to import them, unless you want to type-hint your variables.

.. code-block:: python
:emphasize-lines: 1
from pyrogram.types import User, Message, ...
Expand Down
3 changes: 2 additions & 1 deletion compiler/errors/source/400_BAD_REQUEST.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ CHAT_NOT_MODIFIED The chat settings (title, permissions, photo, etc..) were not
CHAT_RESTRICTED The chat is restricted and cannot be used
CHAT_SEND_INLINE_FORBIDDEN You cannot use inline bots to send messages in this chat
CHAT_TITLE_EMPTY The chat title is empty
CHAT_TOO_BIG The chat is too big for this action
CODE_EMPTY The provided code is empty
CODE_HASH_INVALID The provided code hash invalid
CODE_INVALID The provided code is invalid (i.e. from email)
Expand Down Expand Up @@ -347,4 +348,4 @@ WEBDOCUMENT_URL_EMPTY The web document URL is empty
WEBDOCUMENT_URL_INVALID The web document URL is invalid
WEBPAGE_CURL_FAILED Telegram server could not fetch the provided URL
WEBPAGE_MEDIA_EMPTY The URL doesn't contain any valid media
YOU_BLOCKED_USER You blocked this user
YOU_BLOCKED_USER You blocked this user
2 changes: 1 addition & 1 deletion compiler/errors/source/401_UNAUTHORIZED.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ id message
ACTIVE_USER_REQUIRED The method is only available to already activated users
AUTH_KEY_INVALID The key is invalid
AUTH_KEY_PERM_EMPTY The method is unavailable for temporary authorization key, not bound to permanent
AUTH_KEY_UNREGISTERED The key is not registered in the system
AUTH_KEY_UNREGISTERED The key is not registered in the system. Delete your session file and login again
SESSION_EXPIRED The authorization has expired
SESSION_PASSWORD_NEEDED The two-step verification is enabled and a password is required
SESSION_REVOKED The authorization has been invalidated, because of the user terminating all sessions
Expand Down
8 changes: 0 additions & 8 deletions docs/README.md

This file was deleted.

4 changes: 2 additions & 2 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
sphinx
sphinx_rtd_theme
sphinx_rtd_theme==1.0.0
sphinx_copybutton
pypandoc
requests
sphinx-autobuild
sphinx-autobuild
7 changes: 0 additions & 7 deletions docs/robots.txt

This file was deleted.

84 changes: 0 additions & 84 deletions docs/scripts/releases.py

This file was deleted.

Loading

0 comments on commit 8c82884

Please sign in to comment.