mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-22 14:35:36 +01:00
parent
3efa74c8f2
commit
c5585eed14
1 changed files with 23 additions and 2 deletions
|
@ -6,7 +6,17 @@ Note that the list of required changes is not fully exhaustive and it may lack s
|
|||
### core
|
||||
|
||||
Requests can now be `.await`ed directly, without need of `.send()` or `AutoSend`.
|
||||
If you previously used `AutoSend` adaptor, you can safely remove it.
|
||||
If you previously used `AutoSend` adaptor, you can safely remove it:
|
||||
|
||||
```diff,rust
|
||||
-let bot = Bot::from_env().auto_send();
|
||||
+let bot = Bot::from_env();
|
||||
```
|
||||
|
||||
```diff,rust
|
||||
-async fn start(bot: AutoSend<Bot>, dialogue: MyDialogue, msg: Message) -> HandlerResult {
|
||||
+async fn start(bot: Bot, dialogue: MyDialogue, msg: Message) -> HandlerResult {
|
||||
```
|
||||
|
||||
`File`'s and `FileMeta`'s fields now don't have `file_` prefix.
|
||||
If you previously accessed the fields, you'll need to change remove the prefix:
|
||||
|
@ -52,7 +62,18 @@ See `Sticker` documentation for more information about the new structure.
|
|||
|
||||
### teloxide
|
||||
|
||||
<!-- TODO -->
|
||||
You can now write `Ok(())` instead of `respond(())` at the end of closures provided to RELPs:
|
||||
|
||||
```diff,rust
|
||||
teloxide::repl(bot, |bot: Bot, msg: Message| async move {
|
||||
bot.send_dice(msg.chat.id).await?;
|
||||
- respond(())
|
||||
+ Ok(())
|
||||
})
|
||||
.await;
|
||||
```
|
||||
|
||||
This is because REPLs now require the closure to return `RequestError` instead of a generic error type, so type inference works perfectly for a return value. If you use something other than `RequestError`, you can transfer your code to `teloxide::dispatching`, which still permits a generic error type.
|
||||
|
||||
## 0.9 -> 0.10
|
||||
|
||||
|
|
Loading…
Reference in a new issue