Skip to content

Commit 4eec673

Browse files
committed
Update Pyrogram to v2.0.30
Update to Pyrogram v2.0.30 from the latest commit on the official repo https://github.com/pyrogram/pyrogram/
1 parent a5f9623 commit 4eec673

16 files changed

Lines changed: 56 additions & 122 deletions

File tree

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
<br>
66
<b>Telegram MTProto API Framework for Python</b>
77
<br>
8+
<a href="https://pyrogram.org">
9+
Homepage
10+
</a>
11+
812
<a href="https://docs.pyrogram.org">
913
Documentation
1014
</a>

compiler/errors/source/403_FORBIDDEN.tsv

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,5 @@ USER_INVALID The provided user is invalid
2424
USER_IS_BLOCKED The user is blocked
2525
USER_NOT_MUTUAL_CONTACT The provided user is not a mutual contact
2626
USER_PRIVACY_RESTRICTED The user's privacy settings is preventing you to perform this action
27-
USER_RESTRICTED You are limited/restricted. You can't perform this action
27+
USER_RESTRICTED You are limited/restricted. You can't perform this action
28+
PREMIUM_ACCOUNT_REQUIRED This action requires a premium account

docs/source/faq/how-to-avoid-flood-waits.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ The following shows how to catch the exception in your code and wait the require
99

1010
.. code-block:: python
1111
12-
import time
12+
import asyncio
1313
from pyrogram.errors import FloodWait
1414
1515
...
@@ -20,4 +20,4 @@ The following shows how to catch the exception in your code and wait the require
2020
...
2121
2222
23-
More info about error handling can be found :doc:`here <../start/errors>`.
23+
More info about error handling can be found :doc:`here <../start/errors>`.

pyrogram/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# You should have received a copy of the GNU Lesser General Public License
1717
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
1818

19-
__version__ = "2.0.27"
19+
__version__ = "2.0.30"
2020
__license__ = "GNU Lesser General Public License v3.0 (LGPL-3.0)"
2121
__copyright__ = "Copyright (C) 2017-present Dan <https://github.com/delivrance>"
2222

pyrogram/client.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,8 +270,7 @@ def __init__(
270270

271271
self.disconnect_handler = None
272272

273-
# Username used for mentioned bot commands, e.g.: /start@usernamebot
274-
self.username = None
273+
self.me: Optional[User] = None
275274

276275
self.message_cache = Cache(10000)
277276

pyrogram/filters.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -765,7 +765,7 @@ def command(commands: Union[str, List[str]], prefixes: Union[str, List[str]] = "
765765
command_re = re.compile(r"([\"'])(.*?)(?<!\\)\1|(\S+)")
766766

767767
async def func(flt, client: pyrogram.Client, message: Message):
768-
username = client.username or ""
768+
username = client.me.username or ""
769769
text = message.text or message.caption
770770
message.command = None
771771

pyrogram/methods/advanced/save_file.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,10 @@ async def worker(session):
125125
if file_size == 0:
126126
raise ValueError("File size equals to 0 B")
127127

128-
if file_size > 2000 * 1024 * 1024:
129-
raise ValueError("Telegram doesn't support uploading files bigger than 2000 MiB")
128+
file_size_limit_mib = 4000 if self.me.is_premium else 2000
129+
130+
if file_size > file_size_limit_mib * 1024 * 1024:
131+
raise ValueError(f"Can't upload files bigger than {file_size_limit_mib} MiB")
130132

131133
file_total_parts = int(math.ceil(file_size / part_size))
132134
is_big = file_size > 10 * 1024 * 1024

pyrogram/methods/auth/initialize.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import logging
2020

2121
import pyrogram
22-
from pyrogram.syncer import Syncer
2322

2423
log = logging.getLogger(__name__)
2524

@@ -46,7 +45,7 @@ async def initialize(
4645
self.load_plugins()
4746

4847
await self.dispatcher.start()
49-
await Syncer.add(self)
5048

51-
self.username = (await self.get_me()).username
49+
self.me = await self.get_me()
50+
5251
self.is_initialized = True

pyrogram/methods/auth/terminate.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020

2121
import pyrogram
2222
from pyrogram import raw
23-
from pyrogram.syncer import Syncer
2423

2524
log = logging.getLogger(__name__)
2625

@@ -44,7 +43,7 @@ async def terminate(
4443
await self.invoke(raw.functions.account.FinishTakeoutSession())
4544
log.warning(f"Takeout session {self.takeout_id} finished")
4645

47-
await Syncer.remove(self)
46+
await self.storage.save()
4847
await self.dispatcher.stop()
4948

5049
for media_session in self.media_sessions.values():

pyrogram/methods/messages/send_photo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ async def send_photo(
131131
await app.send_photo("me", "photo.jpg")
132132
133133
# Send photo by uploading from URL
134-
await app.send_photo("me", "https://example.com/example.jpg)
134+
await app.send_photo("me", "https://example.com/example.jpg")
135135
136136
# Add caption to a photo
137137
await app.send_photo("me", "photo.jpg", caption="Caption")

0 commit comments

Comments
 (0)