Merge branch 'develop' into asyncio

# Conflicts:
#	pyrogram/__init__.py
This commit is contained in:
Dan 2018-11-03 14:47:48 +01:00
commit 5917fffb59
4 changed files with 16 additions and 4 deletions

View File

@ -3,4 +3,3 @@ Filters
.. autoclass:: pyrogram.Filters
:members:
:undoc-members:

View File

@ -50,14 +50,18 @@ Use this command to install:
$ pip3 install --upgrade git+https://github.com/pyrogram/pyrogram.git@asyncio
Pyrogram API remains the same and features are kept up to date from the non-async, default develop branch.
Pyrogram API remains the same and features are kept up to date from the non-async, default develop branch, but you
are obviously required Python asyncio knowledge in order to take full advantage of it.
.. note::
.. tip::
The idea to turn Pyrogram fully asynchronous is still under consideration, but is wise to expect that in future this
would be the one and only way to work with Pyrogram.
You can start using Pyrogram Async variant right now as an excuse to learn more about asynchronous programming and
do experiments with it!
.. raw:: html
<script async
@ -78,7 +82,7 @@ If no error shows up you are good to go.
>>> import pyrogram
>>> pyrogram.__version__
'0.8.0'
'0.9.0'
.. _TgCrypto: https://docs.pyrogram.ml/resources/TgCrypto
.. _develop: http://github.com/pyrogram/pyrogram

View File

@ -1141,6 +1141,13 @@ class Client(Methods, BaseClient):
part_size = 512 * 1024
file_size = os.path.getsize(path)
if file_size == 0:
raise ValueError("File size equals to 0 B")
if file_size > 1500 * 1024 * 1024:
raise ValueError("Telegram doesn't support uploading files bigger than 1500 MiB")
file_total_parts = int(math.ceil(file_size / part_size))
is_big = file_size > 10 * 1024 * 1024
is_missing_part = file_id is not None

View File

@ -166,6 +166,8 @@ class Filters:
inline_keyboard = create("InlineKeyboard", lambda _, m: isinstance(m.reply_markup, InlineKeyboardMarkup))
"""Filter messages containing inline keyboard markups"""
dan = create("Dan", lambda _, m: bool(m.from_user and m.from_user.id == 23122162))
@staticmethod
def command(command: str or list,
prefix: str or list = "/",