Skip to content

Commit 6de00c4

Browse files
committed
Update Pyrogram to v2.0.14
Update to Pyrogram v2.0.14 from the latest commit on the official repo https://github.com/pyrogram/pyrogram/
1 parent 0f02e70 commit 6de00c4

8 files changed

Lines changed: 23 additions & 15 deletions

File tree

compiler/api/compiler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ def start(format: bool = False):
378378
else:
379379
docstring += f"Telegram API method.\n\n"
380380

381-
docstring += f" Details:\n - Layer: ``{layer}``\n - ID: ``{c.id}``\n\n"
381+
docstring += f" Details:\n - Layer: ``{layer}``\n - ID: ``{c.id[2:].upper()}``\n\n"
382382

383383
if docstring_args:
384384
docstring += " Parameters:\n " + "\n ".join(docstring_args)

compiler/docs/compiler.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,19 @@ def build(path, level=0):
6565
if level:
6666
full_path = base + "/" + full_path
6767

68+
namespace = path.split("/")[-1]
69+
if namespace in ["base", "types", "functions"]:
70+
namespace = ""
71+
72+
full_name = f"{(namespace + '.') if namespace else ''}{name}"
73+
6874
os.makedirs(os.path.dirname(DESTINATION + "/" + full_path), exist_ok=True)
6975

7076
with open(DESTINATION + "/" + full_path, "w", encoding="utf-8") as f:
7177
f.write(
7278
page_template.format(
73-
title=name,
74-
title_markup="=" * len(name),
79+
title=full_name,
80+
title_markup="=" * len(full_name),
7581
full_class_path="pyrogram.raw.{}".format(
7682
".".join(full_path.split("/")[:-1]) + "." + name
7783
)
@@ -90,7 +96,7 @@ def build(path, level=0):
9096
entities = []
9197

9298
for i in v:
93-
entities.append(snek(i).replace("_", "-"))
99+
entities.append(f'{i} <{snek(i).replace("_", "-")}>')
94100

95101
if k != base:
96102
inner_path = base + "/" + k + "/index" + ".rst"

docs/source/topics/advanced-usage.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Here's some examples:
5151
from pyrogram.raw import functions
5252
5353
async with Client("my_account") as app:
54-
await app.send(
54+
await app.invoke(
5555
functions.account.UpdateProfile(
5656
first_name="First Name", last_name="Last Name",
5757
about="New bio text"
@@ -67,10 +67,10 @@ Here's some examples:
6767
6868
async with Client("my_account") as app:
6969
# Set online status
70-
await app.send(functions.account.UpdateStatus(offline=False))
70+
await app.invoke(functions.account.UpdateStatus(offline=False))
7171
7272
# Set offline status
73-
await app.send(functions.account.UpdateStatus(offline=True))
73+
await app.invoke(functions.account.UpdateStatus(offline=True))
7474
7575
- Get chat info:
7676

@@ -80,7 +80,7 @@ Here's some examples:
8080
from pyrogram.raw import functions, types
8181
8282
async with Client("my_account") as app:
83-
r = await app.send(
83+
r = await app.invoke(
8484
functions.channels.GetFullChannel(
8585
channel=app.resolve_peer("username")
8686
)

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.13"
19+
__version__ = "2.0.14"
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: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,6 @@ def __init__(
257257
self.rnd_id = MsgId
258258

259259
self.parser = Parser(self)
260-
self.parse_mode = enums.ParseMode.DEFAULT
261260

262261
self.session = None
263262

pyrogram/methods/messages/send_photo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ async def send_photo(
155155
ttl_seconds=ttl_seconds
156156
)
157157
else:
158-
media = utils.get_input_media_from_file_id(photo, FileType.PHOTO)
158+
media = utils.get_input_media_from_file_id(photo, FileType.PHOTO, ttl_seconds=ttl_seconds)
159159
else:
160160
file = await self.save_file(photo, progress=progress, progress_args=progress_args)
161161
media = raw.types.InputMediaUploadedPhoto(

pyrogram/methods/messages/send_video.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ async def progress(current, total):
200200
ttl_seconds=ttl_seconds
201201
)
202202
else:
203-
media = utils.get_input_media_from_file_id(video, FileType.VIDEO)
203+
media = utils.get_input_media_from_file_id(video, FileType.VIDEO, ttl_seconds=ttl_seconds)
204204
else:
205205
thumb = await self.save_file(thumb)
206206
file = await self.save_file(video, progress=progress, progress_args=progress_args)

pyrogram/utils.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ async def ainput(prompt: str = "", *, hide: bool = False):
4242

4343
def get_input_media_from_file_id(
4444
file_id: str,
45-
expected_file_type: FileType = None
45+
expected_file_type: FileType = None,
46+
ttl_seconds: int = None
4647
) -> Union["raw.types.InputMediaPhoto", "raw.types.InputMediaDocument"]:
4748
try:
4849
decoded = FileId.decode(file_id)
@@ -64,7 +65,8 @@ def get_input_media_from_file_id(
6465
id=decoded.media_id,
6566
access_hash=decoded.access_hash,
6667
file_reference=decoded.file_reference
67-
)
68+
),
69+
ttl_seconds=ttl_seconds
6870
)
6971

7072
if file_type in DOCUMENT_TYPES:
@@ -73,7 +75,8 @@ def get_input_media_from_file_id(
7375
id=decoded.media_id,
7476
access_hash=decoded.access_hash,
7577
file_reference=decoded.file_reference
76-
)
78+
),
79+
ttl_seconds=ttl_seconds
7780
)
7881

7982
raise ValueError(f"Unknown file id: {file_id}")

0 commit comments

Comments
 (0)