Compare commits

..

11 Commits

Author SHA1 Message Date
dependabot[bot]
255d79bb59 Bump actions/checkout from 5 to 6
Bumps [actions/checkout](https://github.com/actions/checkout) from 5 to 6.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v5...v6)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-21 11:05:14 +00:00
fc10c4c576 Log backtrace and error chain in custom handler
Some checks failed
Build docker image / Build-Docker-Image (push) Has been cancelled
rust-clippy analyze / Run rust-clippy analyzing (push) Has been cancelled
2025-10-26 19:28:25 +01:00
359a6b6137 Add CustomErrorHandler and use it
Some checks are pending
Build docker image / Build-Docker-Image (push) Waiting to run
rust-clippy analyze / Run rust-clippy analyzing (push) Waiting to run
Ignore benign 'Bad Request: message to be replied not found' Telegram
error while logging other errors
2025-10-25 20:16:19 +02:00
17ef8a7f3d Handle AlreadyExists (409) during registration 2025-10-25 19:51:43 +02:00
0d028b6a66 Add helper to skip redundant message edits 2025-10-25 19:15:16 +02:00
9fb550404e Remove unused Source struct from book library types
Some checks failed
Build docker image / Build-Docker-Image (push) Has been cancelled
rust-clippy analyze / Run rust-clippy analyzing (push) Has been cancelled
2025-10-14 17:48:16 +02:00
07c725e0df Merge pull request #42 from flibusta-apps/dependabot/github_actions/github/codeql-action-4
Bump github/codeql-action from 3 to 4
2025-10-14 17:43:04 +02:00
dependabot[bot]
6f2de597b4 Bump github/codeql-action from 3 to 4
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3 to 4.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/v3...v4)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: '4'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-10-08 11:05:43 +00:00
6990f01275 Merge pull request #40 from flibusta-apps/dependabot/github_actions/actions/checkout-5
Some checks failed
Build docker image / Build-Docker-Image (push) Has been cancelled
rust-clippy analyze / Run rust-clippy analyzing (push) Has been cancelled
Bump actions/checkout from 4 to 5
2025-09-10 17:05:00 +02:00
7541680070 Update deps
Some checks failed
Build docker image / Build-Docker-Image (push) Has been cancelled
rust-clippy analyze / Run rust-clippy analyzing (push) Has been cancelled
2025-08-31 13:58:23 +02:00
dependabot[bot]
5a7caef4eb Bump actions/checkout from 4 to 5
Bumps [actions/checkout](https://github.com/actions/checkout) from 4 to 5.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-08-19 18:22:31 +00:00
17 changed files with 277 additions and 170 deletions

View File

@@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v5 uses: actions/checkout@v6
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3 uses: docker/setup-buildx-action@v3

View File

@@ -28,7 +28,7 @@ jobs:
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v6
- name: Install Rust toolchain - name: Install Rust toolchain
uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af #@v1 uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af #@v1
@@ -49,7 +49,7 @@ jobs:
continue-on-error: true continue-on-error: true
- name: Upload analysis results to GitHub - name: Upload analysis results to GitHub
uses: github/codeql-action/upload-sarif@v3 uses: github/codeql-action/upload-sarif@v4
with: with:
sarif_file: rust-clippy-results.sarif sarif_file: rust-clippy-results.sarif
wait-for-processing: true wait-for-processing: true

236
Cargo.lock generated
View File

@@ -21,9 +21,9 @@ dependencies = [
[[package]] [[package]]
name = "actix-http" name = "actix-http"
version = "3.11.0" version = "3.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "44dfe5c9e0004c623edc65391dfd51daa201e7e30ebd9c9bedf873048ec32bc2" checksum = "44cceded2fb55f3c4b67068fa64962e2ca59614edc5b03167de9ff82ae803da0"
dependencies = [ dependencies = [
"actix-codec", "actix-codec",
"actix-rt", "actix-rt",
@@ -70,9 +70,9 @@ dependencies = [
[[package]] [[package]]
name = "actix-rt" name = "actix-rt"
version = "2.10.0" version = "2.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24eda4e2a6e042aa4e55ac438a2ae052d3b5da0ecf83d7411e1a368946925208" checksum = "92589714878ca59a7626ea19734f0e07a6a875197eec751bb5d3f99e64998c63"
dependencies = [ dependencies = [
"futures-core", "futures-core",
"tokio", "tokio",
@@ -207,9 +207,9 @@ dependencies = [
[[package]] [[package]]
name = "anyhow" name = "anyhow"
version = "1.0.98" version = "1.0.99"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e16d2d3311acee920a9eb8d33b8cbc1787ce4a264e85f964c2404b969bdcd487" checksum = "b0674a1ddeecb70197781e945de4b3b8ffb61fa939a5597bcf48503737663100"
[[package]] [[package]]
name = "aquamarine" name = "aquamarine"
@@ -304,9 +304,9 @@ dependencies = [
[[package]] [[package]]
name = "axum-prometheus" name = "axum-prometheus"
version = "0.8.0" version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "42e1a6651f119707ec6c416f38fdb5be223707627fe6d47f912850634c106215" checksum = "fb15221c30bbb32e99873d348d89d7bc2138d6199520aa473a1bdb0d8e5721e8"
dependencies = [ dependencies = [
"axum", "axum",
"bytes", "bytes",
@@ -316,7 +316,7 @@ dependencies = [
"matchit", "matchit",
"metrics", "metrics",
"metrics-exporter-prometheus", "metrics-exporter-prometheus",
"pin-project", "pin-project-lite",
"tokio", "tokio",
"tower", "tower",
"tower-http", "tower-http",
@@ -351,9 +351,9 @@ checksum = "55248b47b0caf0546f7988906588779981c43bb1bc9d0c44087278f80cdb44ba"
[[package]] [[package]]
name = "bitflags" name = "bitflags"
version = "2.9.1" version = "2.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967" checksum = "34efbcccd345379ca2868b2b2c9d3782e9cc58ba87bc7d79d5b53d9c9ae6f25d"
[[package]] [[package]]
name = "block-buffer" name = "block-buffer"
@@ -429,18 +429,18 @@ dependencies = [
[[package]] [[package]]
name = "cc" name = "cc"
version = "1.2.32" version = "1.2.34"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2352e5597e9c544d5e6d9c95190d5d27738ade584fa8db0a16e130e5c2b5296e" checksum = "42bc4aea80032b7bf409b0bc7ccad88853858911b7713a8062fdc0623867bedc"
dependencies = [ dependencies = [
"shlex", "shlex",
] ]
[[package]] [[package]]
name = "cfg-if" name = "cfg-if"
version = "1.0.1" version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268" checksum = "2fd1289c04a9ea8cb22300a459a72a385d7c73d3259e2ed7dcb2af674838cfa9"
[[package]] [[package]]
name = "cfg_aliases" name = "cfg_aliases"
@@ -815,9 +815,9 @@ checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b"
[[package]] [[package]]
name = "form_urlencoded" name = "form_urlencoded"
version = "1.2.1" version = "1.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf"
dependencies = [ dependencies = [
"percent-encoding", "percent-encoding",
] ]
@@ -913,9 +913,9 @@ dependencies = [
[[package]] [[package]]
name = "generator" name = "generator"
version = "0.8.5" version = "0.8.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d18470a76cb7f8ff746cf1f7470914f900252ec36bbc40b569d74b1258446827" checksum = "605183a538e3e2a9c1038635cc5c2d194e2ee8fd0d1b66b8349fad7dbacce5a2"
dependencies = [ dependencies = [
"cc", "cc",
"cfg-if", "cfg-if",
@@ -955,7 +955,7 @@ dependencies = [
"cfg-if", "cfg-if",
"libc", "libc",
"r-efi", "r-efi",
"wasi 0.14.2+wasi-0.2.4", "wasi 0.14.3+wasi-0.2.4",
] ]
[[package]] [[package]]
@@ -976,7 +976,7 @@ dependencies = [
"futures-core", "futures-core",
"futures-sink", "futures-sink",
"http 1.3.1", "http 1.3.1",
"indexmap 2.10.0", "indexmap 2.11.0",
"slab", "slab",
"tokio", "tokio",
"tokio-util", "tokio-util",
@@ -1080,13 +1080,14 @@ checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9"
[[package]] [[package]]
name = "hyper" name = "hyper"
version = "1.6.0" version = "1.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cc2b571658e38e0c01b1fdca3bbbe93c00d3d71693ff2770043f8c29bc7d6f80" checksum = "eb3aa54a13a0dfe7fbe3a59e0c76093041720fdc77b110cc0fc260fafb4dc51e"
dependencies = [ dependencies = [
"atomic-waker",
"bytes", "bytes",
"futures-channel", "futures-channel",
"futures-util", "futures-core",
"h2", "h2",
"http 1.3.1", "http 1.3.1",
"http-body", "http-body",
@@ -1094,6 +1095,7 @@ dependencies = [
"httpdate", "httpdate",
"itoa", "itoa",
"pin-project-lite", "pin-project-lite",
"pin-utils",
"smallvec", "smallvec",
"tokio", "tokio",
"want", "want",
@@ -1275,9 +1277,9 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
[[package]] [[package]]
name = "idna" name = "idna"
version = "1.0.3" version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "686f825264d630750a544639377bae737628043f20d38bbc029e8f29ea968a7e" checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de"
dependencies = [ dependencies = [
"idna_adapter", "idna_adapter",
"smallvec", "smallvec",
@@ -1332,9 +1334,9 @@ dependencies = [
[[package]] [[package]]
name = "indexmap" name = "indexmap"
version = "2.10.0" version = "2.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fe4cd85333e22411419a0bcae1297d25e58c9443848b11dc6a86fefe8c78a661" checksum = "f2481980430f9f78649238835720ddccc57e52df14ffce1c6f37391d61b563e9"
dependencies = [ dependencies = [
"equivalent", "equivalent",
"hashbrown 0.15.5", "hashbrown 0.15.5",
@@ -1343,9 +1345,9 @@ dependencies = [
[[package]] [[package]]
name = "io-uring" name = "io-uring"
version = "0.7.9" version = "0.7.10"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d93587f37623a1a17d94ef2bc9ada592f5465fe7732084ab7beefabe5c77c0c4" checksum = "046fa2d4d00aea763528b4950358d0ead425372445dc8ff86312b3c69ff7727b"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"cfg-if", "cfg-if",
@@ -1407,9 +1409,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.2.174" version = "0.2.175"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1171693293099992e19cddea4e8b849964e9846f4acee11b3948bcc337be8776" checksum = "6a82ae493e598baaea5209805c49bbf2ea7de956d50d7da0da1164f9c6d28543"
[[package]] [[package]]
name = "linux-raw-sys" name = "linux-raw-sys"
@@ -1471,11 +1473,11 @@ dependencies = [
[[package]] [[package]]
name = "matchers" name = "matchers"
version = "0.1.0" version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" checksum = "d1525a2a28c7f4fa0fc98bb91ae755d1e2d1505079e05539e35bc876b5d65ae9"
dependencies = [ dependencies = [
"regex-automata 0.1.10", "regex-automata",
] ]
[[package]] [[package]]
@@ -1502,23 +1504,23 @@ dependencies = [
[[package]] [[package]]
name = "metrics-exporter-prometheus" name = "metrics-exporter-prometheus"
version = "0.16.2" version = "0.17.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd7399781913e5393588a8d8c6a2867bf85fb38eaf2502fdce465aad2dc6f034" checksum = "2b166dea96003ee2531cf14833efedced545751d800f03535801d833313f8c15"
dependencies = [ dependencies = [
"base64", "base64",
"indexmap 2.10.0", "indexmap 2.11.0",
"metrics", "metrics",
"metrics-util", "metrics-util",
"quanta", "quanta",
"thiserror 1.0.69", "thiserror 2.0.16",
] ]
[[package]] [[package]]
name = "metrics-util" name = "metrics-util"
version = "0.19.1" version = "0.20.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b8496cc523d1f94c1385dd8f0f0c2c480b2b8aeccb5b7e4485ad6365523ae376" checksum = "fe8db7a05415d0f919ffb905afa37784f71901c9a773188876984b4f769ab986"
dependencies = [ dependencies = [
"crossbeam-epoch", "crossbeam-epoch",
"crossbeam-utils", "crossbeam-utils",
@@ -1620,12 +1622,11 @@ dependencies = [
[[package]] [[package]]
name = "nu-ansi-term" name = "nu-ansi-term"
version = "0.46.0" version = "0.50.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" checksum = "d4a28e057d01f97e61255210fcff094d74ed0466038633e95017f5beb68e4399"
dependencies = [ dependencies = [
"overload", "windows-sys 0.52.0",
"winapi",
] ]
[[package]] [[package]]
@@ -1714,12 +1715,6 @@ dependencies = [
"windows-sys 0.52.0", "windows-sys 0.52.0",
] ]
[[package]]
name = "overload"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39"
[[package]] [[package]]
name = "parking" name = "parking"
version = "2.2.1" version = "2.2.1"
@@ -1760,9 +1755,9 @@ dependencies = [
[[package]] [[package]]
name = "percent-encoding" name = "percent-encoding"
version = "2.3.1" version = "2.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220"
[[package]] [[package]]
name = "pin-project" name = "pin-project"
@@ -1809,7 +1804,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3af6b589e163c5a788fab00ce0c0366f6efbb9959c2f9874b224936af7fce7e1" checksum = "3af6b589e163c5a788fab00ce0c0366f6efbb9959c2f9874b224936af7fce7e1"
dependencies = [ dependencies = [
"base64", "base64",
"indexmap 2.10.0", "indexmap 2.11.0",
"quick-xml", "quick-xml",
"serde", "serde",
"time", "time",
@@ -1823,9 +1818,9 @@ checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483"
[[package]] [[package]]
name = "potential_utf" name = "potential_utf"
version = "0.1.2" version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e5a7c30837279ca13e7c867e9e40053bc68740f988cb07f7ca6df43cc734b585" checksum = "84df19adbe5b5a0782edcab45899906947ab039ccf4573713735ee7de1e6b08a"
dependencies = [ dependencies = [
"zerovec", "zerovec",
] ]
@@ -1868,9 +1863,9 @@ dependencies = [
[[package]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "1.0.95" version = "1.0.101"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de"
dependencies = [ dependencies = [
"unicode-ident", "unicode-ident",
] ]
@@ -1901,9 +1896,9 @@ dependencies = [
[[package]] [[package]]
name = "quick-xml" name = "quick-xml"
version = "0.38.1" version = "0.38.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9845d9dccf565065824e69f9f235fafba1587031eda353c1f1561cd6a6be78f4" checksum = "42a232e7487fc2ef313d96dde7948e7a3c05101870d8985e4fd8d26aedd27b89"
dependencies = [ dependencies = [
"memchr", "memchr",
] ]
@@ -2040,59 +2035,44 @@ dependencies = [
[[package]] [[package]]
name = "regex" name = "regex"
version = "1.11.1" version = "1.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" checksum = "23d7fd106d8c02486a8d64e778353d1cffe08ce79ac2e82f540c86d0facf6912"
dependencies = [ dependencies = [
"aho-corasick", "aho-corasick",
"memchr", "memchr",
"regex-automata 0.4.9", "regex-automata",
"regex-syntax 0.8.5", "regex-syntax",
] ]
[[package]] [[package]]
name = "regex-automata" name = "regex-automata"
version = "0.1.10" version = "0.4.10"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" checksum = "6b9458fa0bfeeac22b5ca447c63aaf45f28439a709ccd244698632f9aa6394d6"
dependencies = [
"regex-syntax 0.6.29",
]
[[package]]
name = "regex-automata"
version = "0.4.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908"
dependencies = [ dependencies = [
"aho-corasick", "aho-corasick",
"memchr", "memchr",
"regex-syntax 0.8.5", "regex-syntax",
] ]
[[package]] [[package]]
name = "regex-lite" name = "regex-lite"
version = "0.1.6" version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "53a49587ad06b26609c52e423de037e7f57f20d53535d66e08c695f347df952a" checksum = "943f41321c63ef1c92fd763bfe054d2668f7f225a5c29f0105903dc2fc04ba30"
[[package]] [[package]]
name = "regex-syntax" name = "regex-syntax"
version = "0.6.29" version = "0.8.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" checksum = "caf4aa5b0f434c91fe5c7f1ecb6a5ece2130b02ad2a590589dda5146df959001"
[[package]]
name = "regex-syntax"
version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"
[[package]] [[package]]
name = "reqwest" name = "reqwest"
version = "0.12.22" version = "0.12.23"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cbc931937e6ca3a06e3b6c0aa7841849b160a90351d6ab467a8b9b9959767531" checksum = "d429f34c8092b2d42c7c93cec323bb4adeb7c67698f70839adec842ec10c7ceb"
dependencies = [ dependencies = [
"base64", "base64",
"bytes", "bytes",
@@ -2427,7 +2407,7 @@ dependencies = [
"rand 0.9.2", "rand 0.9.2",
"serde", "serde",
"serde_json", "serde_json",
"thiserror 2.0.12", "thiserror 2.0.16",
"time", "time",
"url", "url",
"uuid", "uuid",
@@ -2455,9 +2435,9 @@ dependencies = [
[[package]] [[package]]
name = "serde_json" name = "serde_json"
version = "1.0.142" version = "1.0.143"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "030fedb782600dcbd6f02d479bf0d817ac3bb40d644745b769d6a96bc3afc5a7" checksum = "d401abef1d108fbd9cbaebc3e46611f4b1021f714a0597a71f41ee463f5f4a5a"
dependencies = [ dependencies = [
"itoa", "itoa",
"memchr", "memchr",
@@ -2497,7 +2477,7 @@ dependencies = [
"chrono", "chrono",
"hex", "hex",
"indexmap 1.9.3", "indexmap 1.9.3",
"indexmap 2.10.0", "indexmap 2.11.0",
"schemars 0.9.0", "schemars 0.9.0",
"schemars 1.0.4", "schemars 1.0.4",
"serde", "serde",
@@ -2670,9 +2650,9 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"
[[package]] [[package]]
name = "syn" name = "syn"
version = "2.0.104" version = "2.0.106"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "17b6f705963418cdb9927482fa304bc562ece2fdd4f616084c50b7023b435a40" checksum = "ede7c438028d4436d71104916910f5bb611972c5cfd7f89b8300a8186e6fada6"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@@ -2759,7 +2739,7 @@ dependencies = [
"serde_json", "serde_json",
"teloxide-core", "teloxide-core",
"teloxide-macros", "teloxide-macros",
"thiserror 2.0.12", "thiserror 2.0.16",
"tokio", "tokio",
"tokio-stream", "tokio-stream",
"tokio-util", "tokio-util",
@@ -2793,7 +2773,7 @@ dependencies = [
"stacker", "stacker",
"take_mut", "take_mut",
"takecell", "takecell",
"thiserror 2.0.12", "thiserror 2.0.16",
"tokio", "tokio",
"tokio-util", "tokio-util",
"url", "url",
@@ -2815,15 +2795,15 @@ dependencies = [
[[package]] [[package]]
name = "tempfile" name = "tempfile"
version = "3.20.0" version = "3.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8a64e3985349f2441a1a9ef0b853f869006c3855f2cda6862a94d26ebb9d6a1" checksum = "15b61f8f20e3a6f7e0649d825294eaf317edce30f82cf6026e7e4cb9222a7d1e"
dependencies = [ dependencies = [
"fastrand", "fastrand",
"getrandom 0.3.3", "getrandom 0.3.3",
"once_cell", "once_cell",
"rustix", "rustix",
"windows-sys 0.59.0", "windows-sys 0.60.2",
] ]
[[package]] [[package]]
@@ -2848,11 +2828,11 @@ dependencies = [
[[package]] [[package]]
name = "thiserror" name = "thiserror"
version = "2.0.12" version = "2.0.16"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708" checksum = "3467d614147380f2e4e374161426ff399c91084acd2363eaf549172b3d5e60c0"
dependencies = [ dependencies = [
"thiserror-impl 2.0.12", "thiserror-impl 2.0.16",
] ]
[[package]] [[package]]
@@ -2868,9 +2848,9 @@ dependencies = [
[[package]] [[package]]
name = "thiserror-impl" name = "thiserror-impl"
version = "2.0.12" version = "2.0.16"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" checksum = "6c5e1be1c48b9172ee610da68fd9cd2770e7a4056cb3fc98710ee6906f0c7960"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@@ -3096,14 +3076,14 @@ dependencies = [
[[package]] [[package]]
name = "tracing-subscriber" name = "tracing-subscriber"
version = "0.3.19" version = "0.3.20"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8189decb5ac0fa7bc8b96b7cb9b2701d60d48805aca84a238004d665fcc4008" checksum = "2054a14f5307d601f88daf0553e1cbf472acc4f2c51afab632431cdcd72124d5"
dependencies = [ dependencies = [
"matchers", "matchers",
"nu-ansi-term", "nu-ansi-term",
"once_cell", "once_cell",
"regex", "regex-automata",
"sharded-slab", "sharded-slab",
"smallvec", "smallvec",
"thread_local", "thread_local",
@@ -3171,9 +3151,9 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"
[[package]] [[package]]
name = "ureq" name = "ureq"
version = "3.0.12" version = "3.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9f0fde9bc91026e381155f8c67cb354bcd35260b2f4a29bcc84639f762760c39" checksum = "00432f493971db5d8e47a65aeb3b02f8226b9b11f1450ff86bb772776ebadd70"
dependencies = [ dependencies = [
"base64", "base64",
"der", "der",
@@ -3184,14 +3164,14 @@ dependencies = [
"rustls-pki-types", "rustls-pki-types",
"ureq-proto", "ureq-proto",
"utf-8", "utf-8",
"webpki-root-certs 0.26.11", "webpki-root-certs",
] ]
[[package]] [[package]]
name = "ureq-proto" name = "ureq-proto"
version = "0.4.2" version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "59db78ad1923f2b1be62b6da81fe80b173605ca0d57f85da2e005382adf693f7" checksum = "bbe120bb823a0061680e66e9075942fcdba06d46551548c2c259766b9558bc9a"
dependencies = [ dependencies = [
"base64", "base64",
"http 1.3.1", "http 1.3.1",
@@ -3201,9 +3181,9 @@ dependencies = [
[[package]] [[package]]
name = "url" name = "url"
version = "2.5.4" version = "2.5.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60" checksum = "08bc136a29a3d1758e07a9cca267be308aeebf5cfd5a10f3f67ab2097683ef5b"
dependencies = [ dependencies = [
"form_urlencoded", "form_urlencoded",
"idna", "idna",
@@ -3225,9 +3205,9 @@ checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be"
[[package]] [[package]]
name = "uuid" name = "uuid"
version = "1.17.0" version = "1.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3cf4199d1e5d15ddd86a694e4d0dffa9c323ce759fea589f00fef9d81cc1931d" checksum = "f33196643e165781c20a5ead5582283a7dacbb87855d867fbc2df3f81eddc1be"
dependencies = [ dependencies = [
"getrandom 0.3.3", "getrandom 0.3.3",
"js-sys", "js-sys",
@@ -3276,11 +3256,11 @@ checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"
[[package]] [[package]]
name = "wasi" name = "wasi"
version = "0.14.2+wasi-0.2.4" version = "0.14.3+wasi-0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9683f9a5a998d873c0d21fcbe3c083009670149a8fab228644b8bd36b2c48cb3" checksum = "6a51ae83037bdd272a9e28ce236db8c07016dd0d50c27038b3f407533c030c95"
dependencies = [ dependencies = [
"wit-bindgen-rt", "wit-bindgen",
] ]
[[package]] [[package]]
@@ -3377,15 +3357,6 @@ dependencies = [
"wasm-bindgen", "wasm-bindgen",
] ]
[[package]]
name = "webpki-root-certs"
version = "0.26.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "75c7f0ef91146ebfb530314f5f1d24528d7f0767efbfd31dce919275413e393e"
dependencies = [
"webpki-root-certs 1.0.2",
]
[[package]] [[package]]
name = "webpki-root-certs" name = "webpki-root-certs"
version = "1.0.2" version = "1.0.2"
@@ -3696,13 +3667,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486" checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486"
[[package]] [[package]]
name = "wit-bindgen-rt" name = "wit-bindgen"
version = "0.39.0" version = "0.45.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1" checksum = "052283831dbae3d879dc7f51f3d92703a316ca49f91540417d38591826127814"
dependencies = [
"bitflags",
]
[[package]] [[package]]
name = "writeable" name = "writeable"

View File

@@ -27,7 +27,7 @@ tokio-stream = "0.1.17"
futures = "0.3.31" futures = "0.3.31"
axum = "0.8.3" axum = "0.8.3"
axum-prometheus = "0.8.0" axum-prometheus = "0.9.0"
tower = "0.5.2" tower = "0.5.2"
tower-http = { version = "0.6.2", features = ["trace"] } tower-http = { version = "0.6.2", features = ["trace"] }

View File

@@ -18,7 +18,9 @@ use tokio_util::compat::FuturesAsyncReadCompatExt;
use crate::bots::{ use crate::bots::{
approved_bot::{ approved_bot::{
modules::utils::pagination::generic_get_pagination_keyboard, modules::utils::{
message_text::is_message_text_equals, pagination::generic_get_pagination_keyboard,
},
services::book_library::{get_author_annotation, get_book_annotation}, services::book_library::{get_author_annotation, get_book_annotation},
tools::filter_callback_query, tools::filter_callback_query,
}, },
@@ -145,17 +147,24 @@ where
} else { } else {
chunked_text.len() chunked_text.len()
}; };
let current_text = chunked_text.get(page_index - 1).unwrap(); let new_text = chunked_text.get(page_index - 1).unwrap();
let keyboard = let keyboard =
generic_get_pagination_keyboard(page, chunked_text.len().try_into()?, callback_data, false); generic_get_pagination_keyboard(page, chunked_text.len().try_into()?, callback_data, false);
bot.edit_message_text(message.chat().id, message.id(), current_text) if is_message_text_equals(Some(message.clone()), new_text) {
return Ok(());
}
match bot
.edit_message_text(message.chat().id, message.id(), new_text)
.reply_markup(keyboard) .reply_markup(keyboard)
.send() .send()
.await?; .await
{
Ok(()) Ok(_) => Ok(()),
Err(err) => Err(err.into()),
}
} }
pub fn get_annotations_handler() -> crate::bots::BotHandler { pub fn get_annotations_handler() -> crate::bots::BotHandler {

View File

@@ -15,6 +15,7 @@ use teloxide::{
use tracing::log; use tracing::log;
use crate::bots::approved_bot::{ use crate::bots::approved_bot::{
modules::utils::message_text::is_message_text_equals,
services::{ services::{
book_library::{ book_library::{
formatters::{Format, FormatTitle}, formatters::{Format, FormatTitle},
@@ -176,12 +177,19 @@ where
let keyboard = generic_get_pagination_keyboard(page, items_page.pages, callback_data, true); let keyboard = generic_get_pagination_keyboard(page, items_page.pages, callback_data, true);
bot.edit_message_text(chat_id, message_id, formatted_page) if is_message_text_equals(cq.message, &formatted_page) {
return Ok(());
}
match bot
.edit_message_text(chat_id, message_id, formatted_page)
.reply_markup(keyboard) .reply_markup(keyboard)
.send() .send()
.await?; .await
{
Ok(()) Ok(_) => Ok(()),
Err(err) => Err(err.into()),
}
} }
pub fn get_book_handler() -> crate::bots::BotHandler { pub fn get_book_handler() -> crate::bots::BotHandler {

View File

@@ -14,6 +14,7 @@ use teloxide::{
use crate::bots::{ use crate::bots::{
approved_bot::{ approved_bot::{
modules::utils::message_text::is_message_text_equals,
services::{ services::{
book_library::{ book_library::{
formatters::{Format, FormatTitle}, formatters::{Format, FormatTitle},
@@ -45,7 +46,7 @@ where
let chat_id = cq.chat_id(); let chat_id = cq.chat_id();
let user_id = cq.from.id; let user_id = cq.from.id;
let message_id = cq.message.as_ref().map(|message| message.id()); let message_id = cq.message.as_ref().map(|message| message.id());
let query = get_query(cq); let query = get_query(cq.clone());
let (chat_id, query, message_id) = match (chat_id, query, message_id) { let (chat_id, query, message_id) = match (chat_id, query, message_id) {
(Some(chat_id), Some(query), Some(message_id)) => (chat_id, query, message_id), (Some(chat_id), Some(query), Some(message_id)) => (chat_id, query, message_id),
@@ -106,15 +107,20 @@ where
} }
let formatted_page = items_page.format(page, 4096); let formatted_page = items_page.format(page, 4096);
if is_message_text_equals(cq.message, &formatted_page) {
return Ok(());
}
let keyboard = generic_get_pagination_keyboard(page, items_page.pages, search_data, true); let keyboard = generic_get_pagination_keyboard(page, items_page.pages, search_data, true);
match bot
bot.edit_message_text(chat_id, message_id, formatted_page) .edit_message_text(chat_id, message_id, formatted_page)
.reply_markup(keyboard) .reply_markup(keyboard)
.send() .send()
.await?; .await
{
Ok(()) Ok(_) => Ok(()),
Err(err) => Err(err.into()),
}
} }
pub async fn message_handler(message: Message, bot: CacheMe<Throttle<Bot>>) -> BotHandlerInternal { pub async fn message_handler(message: Message, bot: CacheMe<Throttle<Bot>>) -> BotHandlerInternal {

View File

@@ -4,7 +4,10 @@ pub mod commands;
use chrono::{prelude::*, Duration}; use chrono::{prelude::*, Duration};
use crate::bots::{ use crate::bots::{
approved_bot::{services::book_library::get_uploaded_books, tools::filter_callback_query}, approved_bot::{
modules::utils::message_text::is_message_text_equals,
services::book_library::get_uploaded_books, tools::filter_callback_query,
},
BotHandlerInternal, BotHandlerInternal,
}; };
@@ -78,7 +81,7 @@ async fn update_log_pagination_handler(
bot: CacheMe<Throttle<Bot>>, bot: CacheMe<Throttle<Bot>>,
update_callback_data: UpdateLogCallbackData, update_callback_data: UpdateLogCallbackData,
) -> BotHandlerInternal { ) -> BotHandlerInternal {
let message = match cq.message { let message = match cq.message.clone() {
Some(v) => v, Some(v) => v,
None => { None => {
bot.send_message(cq.from.id, "Ошибка! Попробуйте заново(") bot.send_message(cq.from.id, "Ошибка! Попробуйте заново(")
@@ -138,14 +141,20 @@ async fn update_log_pagination_handler(
let formatted_page = items_page.format(page, 4096); let formatted_page = items_page.format(page, 4096);
let message_text = format!("{header}{formatted_page}"); let message_text = format!("{header}{formatted_page}");
if is_message_text_equals(cq.message, &message_text) {
return Ok(());
}
let keyboard = generic_get_pagination_keyboard(page, total_pages, update_callback_data, true); let keyboard = generic_get_pagination_keyboard(page, total_pages, update_callback_data, true);
bot.edit_message_text(message.chat().id, message.id(), message_text) match bot
.edit_message_text(message.chat().id, message.id(), message_text)
.reply_markup(keyboard) .reply_markup(keyboard)
.send() .send()
.await?; .await
{
Ok(()) Ok(_) => Ok(()),
Err(err) => Err(err.into()),
}
} }
pub fn get_update_log_handler() -> crate::bots::BotHandler { pub fn get_update_log_handler() -> crate::bots::BotHandler {

View File

@@ -0,0 +1,18 @@
use teloxide::types::*;
pub fn is_message_text_equals(message: Option<MaybeInaccessibleMessage>, text: &str) -> bool {
let message = match message {
Some(v) => v,
None => return false,
};
let message = match message {
MaybeInaccessibleMessage::Inaccessible(_) => return false,
MaybeInaccessibleMessage::Regular(v) => v,
};
match message.text() {
Some(msg_text) => text == msg_text,
None => false,
}
}

View File

@@ -1,4 +1,5 @@
pub mod errors; pub mod errors;
pub mod filter_command; pub mod filter_command;
pub mod message_text;
pub mod pagination; pub mod pagination;
pub mod split_text; pub mod split_text;

View File

@@ -32,12 +32,6 @@ impl BookGenre {
} }
} }
#[derive(Deserialize, Debug, Clone)]
pub struct Source {
// id: u32,
// name: String
}
#[derive(Deserialize, Debug, Clone)] #[derive(Deserialize, Debug, Clone)]
pub struct Author { pub struct Author {
pub id: u32, pub id: u32,

View File

@@ -19,9 +19,10 @@ pub async fn message_handler(message: Message, bot: CacheMe<Throttle<Bot>>) -> a
let message_text = match result { let message_text = match result {
register::RegisterStatus::Success { ref username } => format_registered_message(username), register::RegisterStatus::Success { ref username } => format_registered_message(username),
register::RegisterStatus::RegisterFail => strings::ALREADY_REGISTERED.to_string(), register::RegisterStatus::RegisterFail => strings::MAY_BE_ALREADY_REGISTERED.to_string(),
register::RegisterStatus::LimitExtended => strings::LIMIT_EXTENDED_MESSAGE.to_string(), register::RegisterStatus::LimitExtended => strings::LIMIT_EXTENDED_MESSAGE.to_string(),
register::RegisterStatus::WrongToken => strings::ERROR_MESSAGE.to_string(), register::RegisterStatus::WrongToken => strings::ERROR_MESSAGE.to_string(),
register::RegisterStatus::AlreadyExists => strings::ALREADY_EXISTS_MESSAGE.to_string(),
}; };
bot.send_message(message.chat.id, message_text) bot.send_message(message.chat.id, message_text)

View File

@@ -12,12 +12,14 @@ pub enum RegisterStatus {
WrongToken, WrongToken,
RegisterFail, RegisterFail,
LimitExtended, LimitExtended,
AlreadyExists,
} }
#[derive(Debug)] #[derive(Debug)]
pub enum RegisterRequestStatus { pub enum RegisterRequestStatus {
Success, Success,
LimitExtended, LimitExtended,
AlreadyExists,
UnknownError, UnknownError,
} }
@@ -52,6 +54,7 @@ async fn make_register_request(
Ok(match result.status().as_u16() { Ok(match result.status().as_u16() {
200 => RegisterRequestStatus::Success, 200 => RegisterRequestStatus::Success,
402 => RegisterRequestStatus::LimitExtended, 402 => RegisterRequestStatus::LimitExtended,
409 => RegisterRequestStatus::AlreadyExists,
_ => RegisterRequestStatus::UnknownError, _ => RegisterRequestStatus::UnknownError,
}) })
} }
@@ -81,5 +84,6 @@ pub async fn register(user_id: UserId, message_text: &str) -> RegisterStatus {
}, },
RegisterRequestStatus::LimitExtended => RegisterStatus::LimitExtended, RegisterRequestStatus::LimitExtended => RegisterStatus::LimitExtended,
RegisterRequestStatus::UnknownError => RegisterStatus::RegisterFail, RegisterRequestStatus::UnknownError => RegisterStatus::RegisterFail,
RegisterRequestStatus::AlreadyExists => RegisterStatus::AlreadyExists,
} }
} }

View File

@@ -2,8 +2,10 @@ pub fn format_registered_message(username: &str) -> String {
format!("@{username} зарегистрирован и через несколько минут будет подключен!") format!("@{username} зарегистрирован и через несколько минут будет подключен!")
} }
pub const ALREADY_REGISTERED: &str = "Ошибка! Возможно бот уже зарегистрирован!"; pub const MAY_BE_ALREADY_REGISTERED: &str = "Ошибка! Возможно бот уже зарегистрирован!";
pub const ERROR_MESSAGE: &str = "Ошибка! Что-то не так с ботом!"; pub const ERROR_MESSAGE: &str = "Ошибка! Что-то не так с ботом!";
pub const LIMIT_EXTENDED_MESSAGE: &str = "Вы достигли максимального количества ботов!"; pub const LIMIT_EXTENDED_MESSAGE: &str = "Вы достигли максимального количества ботов!";
pub const ALREADY_EXISTS_MESSAGE: &str = "Ошибка! Бот с таким токеном уже зарегистрирован!";

View File

@@ -0,0 +1,85 @@
use std::future::Future;
use std::pin::Pin;
use std::sync::Arc;
use tracing::log;
pub struct CustomErrorHandler {
pub text: String,
}
impl CustomErrorHandler {
pub fn with_custom_text<T>(text: T) -> Arc<Self>
where
T: Into<String>,
{
Arc::new(Self { text: text.into() })
}
}
impl<E> teloxide::error_handlers::ErrorHandler<E> for CustomErrorHandler
where
E: std::fmt::Debug + Send + 'static,
{
fn handle_error(
self: Arc<Self>,
error: E,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'static>> {
Box::pin(async move {
let error_string = format!("{:?}", error);
if error_string.contains("Bad Request: message to be replied not found") {
log::debug!("Ignoring Telegram reply error: {:?}", error);
return;
}
let backtrace = std::backtrace::Backtrace::force_capture();
let error_chain = if let Some(std_error) =
(&error as &dyn std::any::Any).downcast_ref::<Box<dyn std::error::Error>>()
{
let mut chain = Vec::new();
let mut source = std_error.source();
while let Some(err) = source {
chain.push(format!(" Caused by: {}", err));
source = err.source();
}
if chain.is_empty() {
String::new()
} else {
format!("\nError chain:\n{}", chain.join("\n"))
}
} else {
String::new()
};
let backtrace_info = match backtrace.status() {
std::backtrace::BacktraceStatus::Captured => {
format!("\nBacktrace:\n{}", backtrace)
}
std::backtrace::BacktraceStatus::Disabled => {
"\nBacktrace: disabled (compile with debug info for stack traces)".to_string()
}
std::backtrace::BacktraceStatus::Unsupported => {
"\nBacktrace: unsupported on this platform".to_string()
}
_ => String::new(),
};
log::error!(
"{}: {:?}{}{}",
self.text,
error,
error_chain,
backtrace_info
);
})
}
}
impl Default for CustomErrorHandler {
fn default() -> Self {
Self {
text: "An error from the update listener".to_string(),
}
}
}

View File

@@ -1,6 +1,7 @@
use super::custom_error_handler::CustomErrorHandler;
use teloxide::adaptors::throttle::Limits; use teloxide::adaptors::throttle::Limits;
use teloxide::dispatching::Dispatcher; use teloxide::dispatching::Dispatcher;
use teloxide::error_handlers::LoggingErrorHandler;
use teloxide::requests::{Request, Requester, RequesterExt}; use teloxide::requests::{Request, Requester, RequesterExt};
use teloxide::stop::StopToken; use teloxide::stop::StopToken;
use teloxide::stop::{mk_stop_token, StopFlag}; use teloxide::stop::{mk_stop_token, StopFlag};
@@ -108,7 +109,7 @@ pub async fn start_bot(bot_data: &BotData) {
dispatcher dispatcher
.dispatch_with_listener( .dispatch_with_listener(
listener, listener,
LoggingErrorHandler::with_custom_text("An error from the update listener"), CustomErrorHandler::with_custom_text("An error from the update listener"),
) )
.await; .await;
}); });

View File

@@ -1,6 +1,7 @@
pub mod axum_server; pub mod axum_server;
pub mod bot_manager_client; pub mod bot_manager_client;
pub mod closable_sender; pub mod closable_sender;
pub mod custom_error_handler;
pub mod internal; pub mod internal;
pub mod utils; pub mod utils;