ferogram 0.4.0__tar.gz → 0.4.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ferogram-0.4.1/.readthedocs.yaml +35 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/Cargo.lock +23 -12
- {ferogram-0.4.0 → ferogram-0.4.1}/Cargo.toml +2 -2
- {ferogram-0.4.0 → ferogram-0.4.1}/PKG-INFO +1 -1
- {ferogram-0.4.0 → ferogram-0.4.1}/pyproject.toml +1 -1
- {ferogram-0.4.0 → ferogram-0.4.1}/src/client.rs +27 -15
- {ferogram-0.4.0 → ferogram-0.4.1}/.github/workflows/compile-check.yml +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/.github/workflows/publish.yml +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/.gitignore +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/CHANGELOG.md +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/FEATURES.md +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/LICENSE-APACHE +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/LICENSE-MIT +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/README.md +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/examples/admin_tools.py +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/examples/command_bot.py +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/examples/echo_bot.py +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/examples/group_management.py +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/examples/media_bot.py +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/examples/raw_invoke.py +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/examples/search_bot.py +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/examples/send_hi.py +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/examples/send_media.py +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/examples/send_message.py +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/examples/update_handlers.py +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/examples/user_management.py +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/examples/userbot.py +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/ferogram/__init__.py +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/ferogram/client.py +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/ferogram/filters.py +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/ferogram/logging.py +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/ferogram/py.typed +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/ferogram/raw/__init__.py +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/ferogram/raw/api/__init__.py +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/ferogram/raw/api/functions.py +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/ferogram/raw/api/types.py +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/ferogram/raw/codegen.py +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/ferogram/raw/generated/__init__.py +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/ferogram/raw/generated/_tl_schema.py +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/ferogram/raw/generated/functions/__init__.py +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/ferogram/raw/generated/functions/account.py +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/ferogram/raw/generated/functions/aicompose.py +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/ferogram/raw/generated/functions/auth.py +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/ferogram/raw/generated/functions/bots.py +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/ferogram/raw/generated/functions/channels.py +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/ferogram/raw/generated/functions/chatlists.py +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/ferogram/raw/generated/functions/contacts.py +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/ferogram/raw/generated/functions/folders.py +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/ferogram/raw/generated/functions/fragment.py +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/ferogram/raw/generated/functions/help.py +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/ferogram/raw/generated/functions/langpack.py +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/ferogram/raw/generated/functions/messages.py +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/ferogram/raw/generated/functions/payments.py +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/ferogram/raw/generated/functions/phone.py +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/ferogram/raw/generated/functions/photos.py +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/ferogram/raw/generated/functions/premium.py +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/ferogram/raw/generated/functions/smsjobs.py +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/ferogram/raw/generated/functions/stats.py +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/ferogram/raw/generated/functions/stickers.py +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/ferogram/raw/generated/functions/stories.py +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/ferogram/raw/generated/functions/updates.py +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/ferogram/raw/generated/functions/upload.py +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/ferogram/raw/generated/functions/users.py +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/ferogram/raw/generated/types/__init__.py +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/ferogram/raw/generated/types/_base.py +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/ferogram/raw/generated/types/account.py +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/ferogram/raw/generated/types/aicompose.py +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/ferogram/raw/generated/types/auth.py +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/ferogram/raw/generated/types/bots.py +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/ferogram/raw/generated/types/channels.py +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/ferogram/raw/generated/types/chatlists.py +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/ferogram/raw/generated/types/contacts.py +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/ferogram/raw/generated/types/fragment.py +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/ferogram/raw/generated/types/help.py +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/ferogram/raw/generated/types/messages.py +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/ferogram/raw/generated/types/payments.py +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/ferogram/raw/generated/types/phone.py +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/ferogram/raw/generated/types/photos.py +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/ferogram/raw/generated/types/premium.py +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/ferogram/raw/generated/types/smsjobs.py +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/ferogram/raw/generated/types/stats.py +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/ferogram/raw/generated/types/stickers.py +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/ferogram/raw/generated/types/storage.py +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/ferogram/raw/generated/types/stories.py +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/ferogram/raw/generated/types/updates.py +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/ferogram/raw/generated/types/upload.py +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/ferogram/raw/generated/types/users.py +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/ferogram/raw/proxy.py +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/ferogram/raw/tl.py +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/ferogram/raw_api.tl +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/ferogram/types.py +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/src/auth.rs +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/src/keyboards.rs +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/src/lib.rs +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/src/message.rs +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/src/raw.rs +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/src/session.rs +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/src/types.rs +0 -0
- {ferogram-0.4.0 → ferogram-0.4.1}/src/updates.rs +0 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Read the Docs configuration file for Sphinx projects
|
|
2
|
+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
|
|
3
|
+
|
|
4
|
+
# Required
|
|
5
|
+
version: 2
|
|
6
|
+
|
|
7
|
+
# Set the OS, Python version and other tools you might need
|
|
8
|
+
build:
|
|
9
|
+
os: ubuntu-24.04
|
|
10
|
+
tools:
|
|
11
|
+
python: "3.12"
|
|
12
|
+
# You can also specify other tool versions:
|
|
13
|
+
# nodejs: "20"
|
|
14
|
+
# rust: "1.70"
|
|
15
|
+
# golang: "1.20"
|
|
16
|
+
|
|
17
|
+
# Build documentation in the "docs/" directory with Sphinx
|
|
18
|
+
sphinx:
|
|
19
|
+
configuration: docs/conf.py
|
|
20
|
+
# You can configure Sphinx to use a different builder, for instance use the dirhtml builder for simpler URLs
|
|
21
|
+
# builder: "dirhtml"
|
|
22
|
+
# Fail on all warnings to avoid broken references
|
|
23
|
+
# fail_on_warning: true
|
|
24
|
+
|
|
25
|
+
# Optionally build your docs in additional formats such as PDF and ePub
|
|
26
|
+
# formats:
|
|
27
|
+
# - pdf
|
|
28
|
+
# - epub
|
|
29
|
+
|
|
30
|
+
# Optional but recommended, declare the Python requirements required
|
|
31
|
+
# to build your documentation
|
|
32
|
+
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
|
|
33
|
+
# python:
|
|
34
|
+
# install:
|
|
35
|
+
# - requirements: docs/requirements.txt
|
|
@@ -458,7 +458,8 @@ checksum = "7360491ce676a36bf9bb3c56c1aa791658183a54d2744120f27285738d90465a"
|
|
|
458
458
|
[[package]]
|
|
459
459
|
name = "ferogram"
|
|
460
460
|
version = "0.6.0"
|
|
461
|
-
source = "
|
|
461
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
462
|
+
checksum = "35327fc700fc4884b847888970e571eadf9a788d759b005569517b0f3824dd96"
|
|
462
463
|
dependencies = [
|
|
463
464
|
"base64 0.22.1",
|
|
464
465
|
"chrono",
|
|
@@ -493,7 +494,8 @@ dependencies = [
|
|
|
493
494
|
[[package]]
|
|
494
495
|
name = "ferogram-connect"
|
|
495
496
|
version = "0.6.0"
|
|
496
|
-
source = "
|
|
497
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
498
|
+
checksum = "97fed37f5b36213d4e87a8a8ae9b277cf3e45022a701e428a771a5b25f73339c"
|
|
497
499
|
dependencies = [
|
|
498
500
|
"ferogram-crypto",
|
|
499
501
|
"ferogram-mtproto",
|
|
@@ -512,7 +514,8 @@ dependencies = [
|
|
|
512
514
|
[[package]]
|
|
513
515
|
name = "ferogram-crypto"
|
|
514
516
|
version = "0.6.0"
|
|
515
|
-
source = "
|
|
517
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
518
|
+
checksum = "0f78840bea359e02551316d3726f0735bec4528d18f7926cfbbd86f99a12980d"
|
|
516
519
|
dependencies = [
|
|
517
520
|
"aes",
|
|
518
521
|
"ctr",
|
|
@@ -526,7 +529,8 @@ dependencies = [
|
|
|
526
529
|
[[package]]
|
|
527
530
|
name = "ferogram-fsm"
|
|
528
531
|
version = "0.6.0"
|
|
529
|
-
source = "
|
|
532
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
533
|
+
checksum = "c220365f36c0b1cfa935cb104f7d853cb009ff693f82851472b3bbd1cbf5e6ce"
|
|
530
534
|
dependencies = [
|
|
531
535
|
"async-trait",
|
|
532
536
|
"dashmap",
|
|
@@ -538,7 +542,8 @@ dependencies = [
|
|
|
538
542
|
[[package]]
|
|
539
543
|
name = "ferogram-mtproto"
|
|
540
544
|
version = "0.6.0"
|
|
541
|
-
source = "
|
|
545
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
546
|
+
checksum = "3b1205fe74d0ca3123cc5bd6a75a67d9b440af631fa86ee0ff064491b4464a22"
|
|
542
547
|
dependencies = [
|
|
543
548
|
"ferogram-crypto",
|
|
544
549
|
"ferogram-tl-types",
|
|
@@ -552,7 +557,8 @@ dependencies = [
|
|
|
552
557
|
[[package]]
|
|
553
558
|
name = "ferogram-mtsender"
|
|
554
559
|
version = "0.6.0"
|
|
555
|
-
source = "
|
|
560
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
561
|
+
checksum = "ca3ca4efefba40e9fcf1dd984fb4396080ecafce8b600d25c309aea5c0e7e44f"
|
|
556
562
|
dependencies = [
|
|
557
563
|
"ferogram-connect",
|
|
558
564
|
"ferogram-crypto",
|
|
@@ -571,7 +577,8 @@ dependencies = [
|
|
|
571
577
|
[[package]]
|
|
572
578
|
name = "ferogram-parsers"
|
|
573
579
|
version = "0.6.0"
|
|
574
|
-
source = "
|
|
580
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
581
|
+
checksum = "4b83447f6024ffb119e2649c2cc1765f5783ae83e8834128f7c130ed1d0dbf3b"
|
|
575
582
|
dependencies = [
|
|
576
583
|
"ferogram-tl-types",
|
|
577
584
|
"pulldown-cmark",
|
|
@@ -579,7 +586,7 @@ dependencies = [
|
|
|
579
586
|
|
|
580
587
|
[[package]]
|
|
581
588
|
name = "ferogram-py"
|
|
582
|
-
version = "0.4.
|
|
589
|
+
version = "0.4.1"
|
|
583
590
|
dependencies = [
|
|
584
591
|
"ferogram",
|
|
585
592
|
"hex",
|
|
@@ -591,7 +598,8 @@ dependencies = [
|
|
|
591
598
|
[[package]]
|
|
592
599
|
name = "ferogram-session"
|
|
593
600
|
version = "0.6.0"
|
|
594
|
-
source = "
|
|
601
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
602
|
+
checksum = "e5ff2ce020b6907bfbb9ec7b438d8a9beb64e5aada12f557d4aa806db7612247"
|
|
595
603
|
dependencies = [
|
|
596
604
|
"base64 0.22.1",
|
|
597
605
|
"libsql",
|
|
@@ -604,7 +612,8 @@ dependencies = [
|
|
|
604
612
|
[[package]]
|
|
605
613
|
name = "ferogram-tl-gen"
|
|
606
614
|
version = "0.6.0"
|
|
607
|
-
source = "
|
|
615
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
616
|
+
checksum = "6f7bf83f361b3172b975729520730b7527649eaa4d459ccd80a1e164c26a32cd"
|
|
608
617
|
dependencies = [
|
|
609
618
|
"ferogram-tl-parser",
|
|
610
619
|
]
|
|
@@ -612,12 +621,14 @@ dependencies = [
|
|
|
612
621
|
[[package]]
|
|
613
622
|
name = "ferogram-tl-parser"
|
|
614
623
|
version = "0.6.0"
|
|
615
|
-
source = "
|
|
624
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
625
|
+
checksum = "b856a12cceee44dd1182e364f470aae4988398a1bedcac2edc6b7e2228e25fe1"
|
|
616
626
|
|
|
617
627
|
[[package]]
|
|
618
628
|
name = "ferogram-tl-types"
|
|
619
629
|
version = "0.6.0"
|
|
620
|
-
source = "
|
|
630
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
631
|
+
checksum = "0b4ed5f274f97fe97c62ffd3d3fdb5d5a9dfd30b0ab401dcb1fa07b530c60257"
|
|
621
632
|
dependencies = [
|
|
622
633
|
"ferogram-tl-gen",
|
|
623
634
|
"ferogram-tl-parser",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "ferogram-py"
|
|
3
|
-
version = "0.4.
|
|
3
|
+
version = "0.4.1"
|
|
4
4
|
edition = "2024"
|
|
5
5
|
description = "Python bindings for ferogram (Rust MTProto)"
|
|
6
6
|
license = "MIT OR Apache-2.0"
|
|
@@ -12,7 +12,7 @@ crate-type = ["cdylib"]
|
|
|
12
12
|
|
|
13
13
|
[dependencies]
|
|
14
14
|
hex = "0.4"
|
|
15
|
-
ferogram
|
|
15
|
+
ferogram = { version = "0.6.0", features = ["sqlite-session", "libsql-session"] }
|
|
16
16
|
pyo3 = { version = "0.24", features = ["extension-module", "abi3-py313"] }
|
|
17
17
|
pyo3-async-runtimes = { version = "0.24", features = ["tokio-runtime"] }
|
|
18
18
|
tokio = { version = "1", features = ["full"] }
|
|
@@ -375,7 +375,7 @@ impl Client {
|
|
|
375
375
|
) -> PyResult<Bound<'py, PyAny>> {
|
|
376
376
|
let c = Arc::clone(&self.inner);
|
|
377
377
|
future_into_py(py, async move {
|
|
378
|
-
c.pin_message(peer, message_id,
|
|
378
|
+
c.pin_message(peer, message_id, true)
|
|
379
379
|
.await
|
|
380
380
|
.map_err(py_err)?;
|
|
381
381
|
Ok(())
|
|
@@ -2435,12 +2435,22 @@ impl Client {
|
|
|
2435
2435
|
) -> PyResult<Bound<'py, PyAny>> {
|
|
2436
2436
|
let c = Arc::clone(&self.inner);
|
|
2437
2437
|
future_into_py(py, async move {
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
c.get_poll_votes(peer, msg_id, None, 100, None)
|
|
2438
|
+
let result = c
|
|
2439
|
+
.get_poll_votes(peer, msg_id, None, 100, None)
|
|
2441
2440
|
.await
|
|
2442
2441
|
.map_err(py_err)?;
|
|
2443
|
-
|
|
2442
|
+
let pairs: Vec<(i64, Vec<u8>)> = result
|
|
2443
|
+
.votes
|
|
2444
|
+
.into_iter()
|
|
2445
|
+
.map(|v| match v {
|
|
2446
|
+
tl::enums::MessagePeerVote::MessagePeerVote(x) => (x.peer.bare_id(), x.option),
|
|
2447
|
+
tl::enums::MessagePeerVote::InputOption(x) => (x.peer.bare_id(), vec![]),
|
|
2448
|
+
tl::enums::MessagePeerVote::Multiple(x) => {
|
|
2449
|
+
(x.peer.bare_id(), x.options.into_iter().flatten().collect())
|
|
2450
|
+
}
|
|
2451
|
+
})
|
|
2452
|
+
.collect();
|
|
2453
|
+
Ok(pairs)
|
|
2444
2454
|
})
|
|
2445
2455
|
}
|
|
2446
2456
|
|
|
@@ -2918,7 +2928,7 @@ impl Client {
|
|
|
2918
2928
|
fn get_all_drafts<'py>(&self, py: Python<'py>) -> PyResult<Bound<'py, PyAny>> {
|
|
2919
2929
|
let c = Arc::clone(&self.inner);
|
|
2920
2930
|
future_into_py(py, async move {
|
|
2921
|
-
c.
|
|
2931
|
+
c.sync_drafts().await.map_err(py_err)?;
|
|
2922
2932
|
Ok(())
|
|
2923
2933
|
})
|
|
2924
2934
|
}
|
|
@@ -3174,11 +3184,6 @@ impl Client {
|
|
|
3174
3184
|
fn get_input_peer<'py>(&self, py: Python<'py>, peer_id: i64) -> PyResult<Bound<'py, PyAny>> {
|
|
3175
3185
|
let c = Arc::clone(&self.inner);
|
|
3176
3186
|
future_into_py(py, async move {
|
|
3177
|
-
Python::with_gil(|py| {
|
|
3178
|
-
let cache = pyo3::PyErr::take(py); // just to get py handle
|
|
3179
|
-
drop(cache);
|
|
3180
|
-
Ok::<_, pyo3::PyErr>(())
|
|
3181
|
-
})?;
|
|
3182
3187
|
// Build a Peer enum from the raw id using the same sign convention
|
|
3183
3188
|
// as Telegram: positive = user, -100xxxx = channel, small neg = chat
|
|
3184
3189
|
let peer = if peer_id > 0 {
|
|
@@ -3362,20 +3367,27 @@ impl Client {
|
|
|
3362
3367
|
on_progress: Option<Bound<'py, pyo3::types::PyAny>>,
|
|
3363
3368
|
) -> PyResult<Bound<'py, PyAny>> {
|
|
3364
3369
|
let c = Arc::clone(&self.inner);
|
|
3365
|
-
|
|
3366
|
-
let _cb: Option<pyo3::PyObject> = on_progress.map(|f| f.into());
|
|
3370
|
+
let cb: Option<pyo3::PyObject> = on_progress.map(|f| f.into());
|
|
3367
3371
|
future_into_py(py, async move {
|
|
3368
3372
|
let msgs = c.get_messages(peer, &[msg_id]).await.map_err(py_err)?;
|
|
3369
3373
|
let msg = msgs
|
|
3370
3374
|
.into_iter()
|
|
3371
3375
|
.next()
|
|
3372
3376
|
.ok_or_else(|| py_err("message not found"))?;
|
|
3373
|
-
// download_media_with_handle is not on IncomingMessage; use download_media.
|
|
3374
|
-
// on_progress is accepted for API compatibility but not called per-chunk here.
|
|
3375
3377
|
let found = msg.download_media(&path).await.map_err(py_err)?;
|
|
3376
3378
|
if !found {
|
|
3377
3379
|
return Err(py_err("no downloadable media in message"));
|
|
3378
3380
|
}
|
|
3381
|
+
if let Some(ref f) = cb {
|
|
3382
|
+
let size = tokio::fs::metadata(&path)
|
|
3383
|
+
.await
|
|
3384
|
+
.map(|m| m.len())
|
|
3385
|
+
.unwrap_or(0);
|
|
3386
|
+
let _ = Python::with_gil(|py| -> PyResult<()> {
|
|
3387
|
+
f.call1(py, (size, size))?;
|
|
3388
|
+
Ok(())
|
|
3389
|
+
});
|
|
3390
|
+
}
|
|
3379
3391
|
Ok(path)
|
|
3380
3392
|
})
|
|
3381
3393
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|