diff --git a/MIGRATION_GUIDE.md b/MIGRATION_GUIDE.md index ec2f7a6c..c0e3566c 100644 --- a/MIGRATION_GUIDE.md +++ b/MIGRATION_GUIDE.md @@ -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, 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 - +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