mirror of
https://github.com/teloxide/teloxide.git
synced 2025-03-14 11:44:04 +01:00
commit
5ec223f43a
3 changed files with 37 additions and 15 deletions
|
@ -1,6 +1,43 @@
|
|||
This document describes breaking changes of `teloxide` crate, as well as the ways to update code.
|
||||
Note that the list of required changes is not fully exhaustive and it may lack something in rare cases.
|
||||
|
||||
## 0.7 -> 0.8
|
||||
|
||||
### core
|
||||
|
||||
`user.id` now uses `UserId` type, `ChatId` now represents only _chat id_, not channel username, all `chat_id` function parameters now accept `Recipient` (if they allow for channel usernames).
|
||||
|
||||
If you used to work with chat/user ids (for example saving them to a database), you may need to change your code to account for new types. Some examples how that may look like:
|
||||
```diff,
|
||||
-let user_id: i64 = user.id;
|
||||
+let UserId(user_id) = user.id;
|
||||
db.save(user_id, ...);
|
||||
|
||||
-let chat_id: i64 = db.get();
|
||||
+let chat_id = ChatId(db.get());
|
||||
bot.send_message(chat_id, "Hi!").await?;
|
||||
```
|
||||
|
||||
`RequestError::RetryAfter` now has a field of type `Duration`, instead of `i32`.
|
||||
|
||||
### teloxide
|
||||
|
||||
The old dispatching system was removed. If you still hasn't moved to the new one, read the [0.5 -> 0.6 migration guide] for more information on this topic. Note that since the old dispatching was removed, the new dispatching system now lives in the `dispatching` module, **not** `dispatching2` module.
|
||||
|
||||
If you implement `UpdateListener` yourself, note that `StopToken` is now required to be `Send`.
|
||||
|
||||
`BotCommand` trait was renamed to `BotCommands`. `BotCommands::descriptions` not returns `CommandDescriptions` instead of `String`. To get string, you can call `.to_string()`.
|
||||
|
||||
`#[derive(DialogueState)]` is deprecated in favour of `teloxide::handler!`, a more flexible API for dealing with dialogues. [`examples/dialogue.rs`](https://github.com/teloxide/teloxide/blob/03521bfd3d68f6f576dcc44b5473aaa5ce9b553f/examples/dialogue.rs) shows how to use it.
|
||||
|
||||
[0.5 -> 0.6 migration guide]: #05---06
|
||||
|
||||
## 0.6 -> 0.7
|
||||
|
||||
### teloxide
|
||||
|
||||
In order to make `Dispatcher` implement `Send`, `DispatcherBuilder::{default_handler, error_handler}` now accept handlers that implements `Send + Sync`. If you used `!Send` or `!Sync` handlers here, you may need to change that.
|
||||
|
||||
## 0.5 -> 0.6
|
||||
|
||||
### core
|
||||
|
|
|
@ -9,9 +9,6 @@
|
|||
<a href="https://github.com/teloxide/teloxide/actions">
|
||||
<img src="https://github.com/teloxide/teloxide/workflows/Continuous%20integration/badge.svg">
|
||||
</a>
|
||||
<a href="https://teloxide.netlify.com">
|
||||
<img src="https://img.shields.io/badge/docs-dev-blue">
|
||||
</a>
|
||||
<a href="https://crates.io/crates/teloxide">
|
||||
<img src="https://img.shields.io/crates/v/teloxide.svg">
|
||||
</a>
|
||||
|
|
12
netlify.toml
12
netlify.toml
|
@ -1,12 +0,0 @@
|
|||
[build]
|
||||
command = "rustup install nightly-2022-02-02 --profile minimal && cargo +nightly doc --all-features --no-deps -Zunstable-options -Zrustdoc-scrape-examples=examples && cp -r target/doc _netlify_out"
|
||||
publish = "_netlify_out"
|
||||
|
||||
[build.environment]
|
||||
RUSTFLAGS="--cfg dep_docsrs"
|
||||
# FIXME: Add back "-Znormalize-docs" when https://github.com/rust-lang/rust/issues/93703 is fixed
|
||||
RUSTDOCFLAGS= "--cfg docsrs"
|
||||
|
||||
[[redirects]]
|
||||
from = "/"
|
||||
to = "/teloxide"
|
Loading…
Add table
Reference in a new issue