diff --git a/CHANGELOG.md b/CHANGELOG.md index 67ef18dd..4fe36a67 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Add the `Key: Clone` requirement for `impl Dispatcher` [**BC**]. - `dispatching::update_listeners::{polling_default, polling}` now return a named, `Polling<_>` type + - Update teloxide-core to v0.7.0 with Bot API 6.1 support, see [its changelog][core07c] for more [**BC**] + +[core07c]: https://github.com/teloxide/teloxide-core/blob/master/CHANGELOG.md#070---2022-07-19 ### Deprecated diff --git a/Cargo.toml b/Cargo.toml index d5786657..aa08091a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "teloxide" -version = "0.9.2" +version = "0.10.0" edition = "2021" description = "An elegant Telegram bots framework for Rust" repository = "https://github.com/teloxide/teloxide" diff --git a/MIGRATION_GUIDE.md b/MIGRATION_GUIDE.md index 315cd9f1..dd1af6eb 100644 --- a/MIGRATION_GUIDE.md +++ b/MIGRATION_GUIDE.md @@ -1,6 +1,45 @@ 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.9 -> 0.10 + +### core + +We've added some convenience functions to `InlineKeyboardButton` so it's easier to construct it. Consider using them instead of variants: +```diff +-InlineKeyboardButton::new("text", InlineKeyboardButtonKind::Url(url)) ++InlineKeyboardButton::url("text", url) +``` + +`file_size` fields are now `u32`, you may need to update your code accordingly: + +```diff +-let file_size: u64 = audio.file_size?; ++let file_size: u32 = audio.file_size; +``` + +Some places now use `FileMeta` instead of `File`, you may need to change types. + +`Sticker` and `StickerSet` now has a `kind` field instead of `is_animated` and `is_video`: + +```diff ++use teloxide::types::StickerKind::*; +-match () { ++match sticker.kind { +- _ if sticker.is_animated => /* handle animated */, ++ Animated => /* handle animated */, +- _ if sticker.is_video => /* handle video */, ++ Video => /* handle video */, +- _ => /* handle normal */, ++ Webp => /* handle normal */, +} +``` + +### teloxide + +Teloxide itself doesn't have any major API changes. +Note however that `dispatching::update_listeners::polling` function was deprecated, use `polling_builder` instead. + ## 0.7 -> 0.8 ### core @@ -8,7 +47,7 @@ Note that the list of required changes is not fully exhaustive and it may lack s `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, +```diff -let user_id: i64 = user.id; +let UserId(user_id) = user.id; db.save(user_id, ...); diff --git a/README.md b/README.md index 8a5e386d..7e849ec7 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,4 @@ -> [v0.7 -> v0.8 migration guide >>](MIGRATION_GUIDE.md#07---08) - -> `teloxide-core` versions less that `0.4.5` (`teloxide` versions less than 0.7.3) have a low-severity security vulnerability, [learn more >>](https://github.com/teloxide/teloxide/discussions/574) +> [v0.9 -> v0.10 migration guide >>](MIGRATION_GUIDE.md#09---010)
@@ -72,7 +70,7 @@ $ rustup override set nightly 5. Run `cargo new my_bot`, enter the directory and put these lines into your `Cargo.toml`: ```toml [dependencies] -teloxide = { version = "0.9", features = ["macros", "auto-send"] } +teloxide = { version = "0.10", features = ["macros", "auto-send"] } log = "0.4" pretty_env_logger = "0.4" tokio = { version = "1.8", features = ["rt-multi-thread", "macros"] }