mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-22 14:35:36 +01:00
parent
cc74e7517d
commit
a7eff7192b
4 changed files with 46 additions and 6 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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, ...);
|
||||
|
|
|
@ -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)
|
||||
|
||||
<div align="center">
|
||||
<img src="../../raw/master/ICON.png" width="250"/>
|
||||
|
@ -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"] }
|
||||
|
|
Loading…
Reference in a new issue